How to set a correct BuyPrice on the same bar as StopTypeProfit


I made a post but was not verified when posted, so please delete this if that post also shows.

I am investigating a FOREX scalping setup, and the critical code is;

H1 = HHV( H, t1 );
L1 = LLV( L, t1 );

Buy = H > Ref(  HHV( H, 10), -1 ) ;
BuyPrice = Ref(  HHV( H, 10), -1 );
Sell = Null;

prof = prof_atr * ATR( 50 );
loss = loss_atr * ATR( 50 );

ApplyStop( stopTypeProfit   , stopModePoint, prof, 1, 0, 0, 0 );
ApplyStop( stopTypeLoss  , stopModePoint, loss, 1, 0,0, 0 );

That is, it will enter Long if the price is higher then the highest since 10 bars. That works for the first trade. As how, Trade1 will enter a stopTypeProfit on bar 12 (example.. ). Bar 12 will also trigger a new Buy signal. The problem is that the Buyprice in real life will be one of the following;

  1. If stopTypeProfit is lover then "Ref( HHV( H, 10), -1 )" => no problem, the new buy will have a correct BuyPrice.
  2. If the stopTypeProfit is higher then the " Ref( HHV( H, 10), -1 ) " => a problem, as the BuyPrice now will be lower then the real life situation. The buyprice should be the old Bar 12 stopTypeProfit level + slip + spread .

So how can I check if the Buy signal comes on the same bar as a stopTypeProfit , and if so, have a BuyPrice that is the old exit price (plus my slip etc) ..


BR Oppz

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.