ActivateStopsImmediately decides when stops are executed,Profit target stop


I need clarification for following case:

I have s strategy with Donchian Channel based exit and profit target stop at the same time. The problem occurs when:

  1. DC is activated one bar ago
  2. On current Open system should exit the position as per SetTradeDelays
  3. Profit target stop is being reached on the same bar as .2

So, the system choose the exit price to be profit target stop level, instead of Open price. In real trading the system will close the position on Open since target stop level will be reached in the future as the bar progresses.

How to make my system exit on open instead of profit target stop level?

See my code below

upper_band_exit = HHV(H,BandPeriodExit); 
lower_band_exit = LLV(L,BandPeriodExit); 
Sell =  Cross(C, Ref(upper_band_exit, -1));   
Cover =  Cross(Ref(lower_band_exit, -1),C); 
CoverPrice = Open; 
SellPrice = Open; 

profitamount = TP_ATR_Multiple*Ref(ATR(SL_ATR_Period),-1);

You should use correct settings. It is important to use PRE-DEFINED settings ("Scenarios") in ApplyStop. Consult documentation. Specifically you should set "Activate Stops Immediately" to TRUE (Checked).

It is SUPER IMPORTANT to carefully read the documentation on ApplyStop, especially supported "Scenarios"

Without CAREFUL and SLOW study of documentation you are going to be doing mistakes all over again.

Secondly, it is advised to use EQUAL delays in SetTradeDelays (all set to 0 or 1) to avoid confusion. Unequal delays tend to confuse 99% of users because they don't understand what is happening in their own code.
If you need unequal delays, FORGET about SetTradeDelays and shift actual signals using Ref() function.

1 Like

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