Documentation/AlgoCode/Function reference
stop-at
Dynamic analytical stop / target from an expression.
stop at expr target at expr
stop 10 points and target 20 percent flatten a simulated trade on a later bar. stop at and target at store expression levels for the chart. They do not flatten the position and they do not send a broker order. exit 50 percent reduces remaining simulated size. breakeven after 10 points, or breakeven after 1 percent, moves the protective stop to the current average entry once price has moved that far in favor. The entry bar can arm it and cannot close the trade. A later bar applies the trigger before the stop test, so one candle can both arm breakeven and hit it. The price stays armed through a partial exit and clears when the position goes flat. A fixed stop and a trail are combined with it by keeping the tighter price. ATR is not accepted on this line.
Return value
—
Example
when flat and close > ema(close, 20) buy stop at entry price - atr(14) * 2 target at entry price + atr(14) * 3 when long and bars since entry > 20 exit 50 percent