Postby SUPER » 16 Apr 2009
Tj, Tried your suggestion with little modificaiton and you can see from the print statement that on first tick both BuySetUp and ShortSetUp remain true.
[IntrabarOrderGeneration = true]
Vars: intrabarpersist BuySetUp(false),ShortSetUp(false),IntraBarPersist Mp(0);
Vars: intrabarpersist OpenValue(0);
Mp=MarketPosition;
Value1=Average(C[1],3);
OpenValue=Open;
if LastBarOnChart then Print(1,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp);
if C[1] > Value1 then begin
BuySetUp=true;
end;
if LastBarOnChart then Print(2,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp);
if C[1] < Value1 then begin
ShortSetUp=true;
end;
if LastBarOnChart then Print(3,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp);
If Mp=1 then begin
BuySetUp=false;
end;
if LastBarOnChart then Print(4,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp);
If Mp=-1 then begin
ShortSetUp=false;
end;
if LastBarOnChart then Print(5,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp);
if LastBarOnChart then begin
If Mp<>1 and BuySetUp then buy next bar at OpenValue Limit;
If Mp<>-1 and ShortSetUp then SellShort next bar at OpenValue Limit;
End;
if LastBarOnChart then Print(6,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp); SetExitonClose;
if LastBarOnChart then Print(7,",",CurrentBar,",",Value1,",",BuySetUp,",",ShortSetUp,",",OpenValue,",",Mp);
=============
OutPut:
1.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
2.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
3.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
4.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
5.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
6.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
7.00, 634.00, 845.83,TRUE,TRUE, 847.00, 0.00
1.00, 634.00, 845.83,TRUE,TRUE, 847.00, 1.00
2.00, 634.00, 845.83,TRUE,TRUE, 847.00, 1.00
3.00, 634.00, 845.83,TRUE,TRUE, 847.00, 1.00
4.00, 634.00, 845.83,FALSE,TRUE, 847.00, 1.00
5.00, 634.00, 845.83,FALSE,TRUE, 847.00, 1.00
6.00, 634.00, 845.83,FALSE,TRUE, 847.00, 1.00
7.00, 634.00, 845.83,FALSE,TRUE, 847.00, 1.00