Sell to be happen when price close below low of the bar previous to signal bar without applystop function.
Trying the below code , but sell happening when price close below at low of the next bar of Buy .
//plotting price
Plot( C,"",colorDefault,styleCandle);
//condition for buying
Buy = Cross( MACD(), Signal() );
//plot a green arrow below the candle on chart when condition is true
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-12);
//referring to the previous bar before the condition
bar_before_buy=Ref(Buy,-1);
//referring to the previous bar's low before the condition
ll=ValueWhen(bar_before_buy,L);
Plot(ll,"",colorViolet,styleLine|styleDots);
Sell = Cross ( ll , C );
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorWhite,0,L,-12);
Yes that is true for loss and target stops should have to use ApplyStop function or have write looping code . And read the link you have provided.
I must be specific in my earlier post, but i did not so apologize for that.
Actually I want to take short position when price close below low of the bar previous to signal bar. That's why searching for the result without applystop function.
Are you sure you mean Short entry? Your first post talks about Sell which is long exit.
If you really mean entry then look here at Buy limit example
And here at Buy stop example
And change to Short Stop order.
/// based on buy limit/buy stop order examples of
/// @link http://www.amibroker.com/kb/2014/11/26/handling-limit-orders-in-the-backtester/
/// @link https://forum.amibroker.com/t/overriding-amibroker-backtester-settings-generating-unrealistic-results/7374/4
/// responded to in this thread
/// @link https://forum.amibroker.com/t/sell-to-be-happen-when-price-close-below-low-of-the-bar-previous-to-signal-bar-without-applystop-function/12629/5
ShortSignal = Cross( Signal(), MACD() );
// Short on the next bar
Short = Ref(ShortSignal, -1);
ShortStopPrice = Ref(L, -2);// low of the bar previous to signal bar
// now we check if shortstop was hit
Short = Short AND C < ShortStopPrice;
// if Open price is below the shortstop, then we use Open for entry
ShortPrice = Min(Open, ShortStopPrice);
Other than that if in case you still talk about Sell exit and don't want to use ApplyStop then write looping code.