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

Re[2]: Coding help



PureBytes Links

Trading Reference Links

Hello DH,

thanks.  so simple yet so hard to see.


Best regards,
 Jim Johnson                           mailto:jejohn@xxxxxxxxxxx

-- 
Friday, May 17, 2002, 1:43:12 PM, you wrote:

D> Remember, stop orders are executed on the bar following the bar where
D> you issue the order.

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

D> If your conditions are true on the last bar of the day, the trade can be
D> executed on the next bar, which is the opening bar of the next day.

D> Unverified version with an extra var added to eliminate redundant
D> calculations.....

D> {30 min bars only}
        
D> Inputs: Pts(1);
                
D> Vars: BarDir(0), BarHi(0), BarLo(0), MP(0);
D> Vars: DirTime(CalcTime(Sess1StartTime, 60));

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

D> If Time = DirTime then begin
D>         BarDir = Close - Open;
D>         BarHi = High;
D>         BarLo = Low;    
D> End;

If Time >> DirTime and Time < Sess1EndTime then begin
D>         If BarDir < 0 then begin
D>                 Sell at BarLo - Pts Points Stop;
D>                 SetExitonClose; 
D>         End;

D>         If BarDir > 0 then begin
D>                 Buy at BarHi + Pts Points Stop;
D>                 SetExitonClose;
D>         End;
D> End;