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

Coding help



PureBytes Links

Trading Reference Links

Hello Omega-List,

  I'm looking into the predictive ability of the 2nd 30 min bar of
  the day in the SP's.  I want to buy if the 2nd bar is up and sell if
  its down and for this purpose exit at close.  for some reason this
  version is often entering on the first bar rather than after the
  second.  Where am I going wrong (with the code that is)/

  thanks.

  {===============================================================}

{30 min bars only}
        
Inputs: Pts(1);
                
Vars: BarDir(0), BarHi(0), BarLo(0), MP(0);

If D > D[1] then begin
        BarDir = 0;
        BarHi = 0;
        BarLo = 0;
End;

If Time = CalcTime(Sess1StartTime, 60) then begin
        BarDir = Close - Open;
        BarHi = High;
        BarLo = Low;    
End;

If Time > CalcTime(Sess1StartTime, 60) and BarDir < 0 then begin
        Sell at BarLo - Pts Points Stop;
        SetExitonClose; 
End;

If Time > CalcTime(Sess1StartTime, 60) and BarDir > 0 then begin
        Buy at BarHi + Pts Points Stop;
        SetExitonClose;
End;  
{========================================================================}
-- 
Best regards,
 Jim Johnson                         mailto:jejohn@xxxxxxxxxxx