For some traders, they would sometimes put a hard stop as a cut loss. Example 5%, meaning whatever happens, if prices fall below 5% of their buying price, they would execute a sell order. A downside of this method is that it does not account for volatility, so for highly volatile stocks, the cutloss signals will keep on triggering.
A solution to this is to also create a volatility based cut loss method by using the ATR or Average True Range. This way, you can limit premature exits. The first step is to choose a multiple, in this example we use 2. What this means is that we multiply ATR by 2, and subtract that number from the day's close. The resulting value will be the cutloss price. The formula's a bit complicated but simply follow the syntax and you'll be fine.
//ATR based cut loss
set ATRmultiple= 2
set Atr14 = ATR(14)* ATRmultiple
set exitvalue = close - atr14
set BUY = //Put your buy criteria
set sellref = //Put your sell criteria
set ATRexit = blockref(exitvalue,0,buy,sellref)
set SELL = close < atrexit or //Put your sell criteria
Edited. changed condref to blockref