I am running a strategy using the following instructions:
Code: Select all
[IntrabarOrderGeneration = False]
MP = MarketPosition;
if (MP=0 and (Long_Stop=0) and (scale=0) and (stage=0 or stage=1 or stage=2 or stage=3) )
Long_Stop = Close * (1 - (vol_perc_long/100));
Num_Shares_p1 = ((p1_pcent) * (one_perc_dollars/(Close-Long_Stop)) ) ;
Buy ("LE_1") Num_Shares_p1 shares this bar on close;
//Long_Stop = Close * (1 - (vol_perc_long/100));
eprice = close;
I am seeing the following behavior in the attached image
As soon as the trade is stopped out it is executing another trade even though I am using "MP=0" i.e telling it to wait one bar before entering the next trade.
It looks like the MarketPosition does not get set to 1 at the close of the previous trade bar hence once the 1st trade is stopped out it is valid then to execute the second trade.
As soon as the trade is filled how can I get MP to be set to 1?