Applystop stopTypeTrailing with new Activation Point parameter

Hi Experts,

I am trying to activate trailing stop loss with Applystop after reaching 1% profit from entry. After 1 % profit, trailing stop is previous HA (Heinken Ashi) candle open. I am not sure how to calculate the trailing amount, but tried highest high since entry minus stop line. I am expecting whenever the low cuts the stop price, Applystop hits Sell. But I see Sell is occurring before hitting stop line.

Please guide me to identify the mistake..Code is given below...
Thanks in advance.

	TradeDelay = 1; // set it to 0 for no delays	
	SetTradeDelays( TradeDelay, TradeDelay, TradeDelay, TradeDelay );
	SetOption("EveryBarNullCheck", True );
	SetOption( "FuturesMode", False );
	SetOption( "MaxOpenPositions", 100 );
	SetPositionSize( 1, spsShares );

        HaClose = ( O+H+L+C ) / 4;
	HaOpen = AMA( Ref(HaClose, -1), 0.5);
	HaHigh = Max(H, Max(HaClose, HaOpen));
	HaLow = Min(L, Min(HaClose, HaOpen));

	stopTrailHighLine=HighestSince( Buy, High ); 
	ApplyStop( stopTypeTrailing, stopModePercent, trailAmountLong,1, True, 0, 0, -1, 1 );

1 Like

Solved it, problem was due to tradedelay.

	TradeDelay = 1; // set it to 0 for no delays	
	SetTradeDelays( TradeDelay, 0, TradeDelay, 0 );
1 Like