Does anyone know how to create an ATR trailing stop in EFS? I'd like to have a line plotted that equals the last closing price of a security minus a specific ATR value.
Thanks for any help,
Thanks for any help,
if(bDirection) // LONG
vStop = vCostBasis - (vATR.getValue(-1) * vATRMultiplier);
else // SHORT
vStop = vCostBasis + (vATR.getValue(-1) * vATRMultiplier);
if(bDirection) // LONG, only move up
vStop = Math.max(vStop, close(-1) - (vATR.getValue(-1) * vATRMultiplier));
else // SHORT, only move down
vStop = Math.min(vStop, close(-1) + (vATR.getValue(-1) * vATRMultiplier));
Comment