Optimization, Trading Strategy, Fmz Quant, Cryptocurrency, Trends.
:= TSF ma ma MAvg = getMA(src, length) fark = MAvg * percent * 0.01 longStop = MAvg - fark longStopPrev = nz(longStop[1], longStop) longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop shortStop = MAvg + fark shortStopPrev = nz(shortStop[1], shortStop) shortStop := MAvg <