Pair Trading Platform

Quote from henderson:

I attached a screenshot of a software package that I have been building for pairs trading. It allows you to analyze a wide variety of things such as correlation, cointegration, price ranges, etc. Check out the attached picture and if you're interested shoot me a note and I will set you up as a beta tester.

Looks pretty nice henderson... Can you set your own lookback period in order to get a standard deviations from a rolling mean (moving average) And Percent from mean and RSI of the ratio.
 
Quote from Murray Ruggiero:

TradersStudio can be used to trade single contracts we will put the single contract results together using its portfiolo features.
You will create a portfiolo which is the indivdual contracts of both Corn and Wheat, for Corn we use an intermarket of Wheat and for Wheat we use an intermarket of Corn.

Sub CornWheatSpread(SLen)
Dim MKSym As String
Dim CleanSymbol As String
Dim Spread As BarArray
Spread=Close-Close Of independent1
If Spread=Highest(Spread,SLen,0) Then
BuySingleContract(thismarket.Symbol(0)&"BuySide",1,0,Market,Day)
End If
If Spread=Lowest(Spread,Slen,0) Then
sellsinglecontract(thismarket.Symbol(0)&"SellSide",1,0,Market,Day)
End If
End Sub


Here is the code for SellSingleContract, Buy is similar.

Sub SellSingleContract(SignalName,Size, Price, OrderType, OrderTime)
If IsActiveCornContract() Then
Sell(SignalName,Size,Price,OrderType,OrderTime)
Else
ExitAllTrades
End If
End Sub

We only want to generate orders for a contract while it is the active one after that we want to exit all positions.
Here is the code for IsActiveCornContract.
This show the rules for which contract is active for the corn.

Function IsActiveCornContract()
Dim lastChar As String
Dim fileYear As Integer
Dim bOK As Boolean
Dim CleanSymbol As String
bOK=False
CleanSymbol=thismarket.Symbol(0)
If InStr(thisMarket.Symbol(0),".") Then
CleanSymbol=Left(CleanSymbol,Len(CleanSymbol)-4)
End If
lastChar = Ucase(Right(CleanSymbol, 1))
fileYear = CInt(Mid(CleanSymbol, 2, 4))
If lastChar = "Z" Then
If BetweenDates(Date, 8, 23, 11, 23) Then
bOK = True
End If
End If
If lastChar = "U" Then
If BetweenDates(Date, 6, 23, 8, 22) Then
bOK = True
End If
End If
If lastChar = "N" Then
If BetweenDates(Date, 4, 23, 6, 22) Then
bOK = True
End If
End If
If lastChar = "K" Then
If BetweenDates(Date, 2, 23, 4, 22) Then
bOK = True
End If
End If
If fileYear = Year(Date) Then
If lastChar = "H" Then
If BetweenDates(Date, 1, 1, 2, 22) Then
bOK = True
End If
End If
If fileYear = Year(Date) + 1 Then
If lastChar = "H" Then
If BetweenDates(Date, 11, 23, 12, 31) Then
bOK = True
End If
End If
End If
End If
IsActiveCornContract=bOK
End Function

Great stuff Murray Ruggiero! Thanks a lot, I'll give a detailed look on it for my manual trading strategy.
 
Back
Top