[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

correlation code



PureBytes Links

Trading Reference Links

I'm getting different results in my summary report involving the following 
code.  My premise was to take S&P trades filtered by bonds.  I further 
required that the 10 day correlation between Data1(S&P) and Data2(Bonds) be 
greater than .50.  I noticed that reversing the order of some of the code 
lines yielded different report results.  This has me baffeled.  I plotted the 
correlation indicator and the values of the setup day correspond to the code 
requirements.  This is the first time I've had this type of problem, any help 
would be appreciated.     Thanks/John


if close of Data2 > close[1] of Data2
    and dayofweek(date)=3 or dayofweek(date)=4 
    and (Correlation(close of data1, close of data2 , 10) > .50)    
    then  buy ( "VL Buy" ) nOpen + (range * .90)stop ;


If MarketPosition = 1 and close > EntryPrice 
   Then ExitLong ("VL XLMOC")from entry ( "VL Buy" )  on close;

 
If MarketPosition = 1 and nOpen > EntryPrice   
    Then ExitLong ( "VL LX Bail")from entry ( "VL Buy" ) at market;



If MarketPosition = 1  then
   SetStopLoss(3500);