// Downloaded From https://www.WiseStockTrader.com
sZPeriod = Param("Period", 9, 2, 50, 1);
sZK = Param("Coefficient", 2, 0.1, 5, 0.1);
sZHold = Param("Hold Period", 3, 0, 10, 1);

lowDelta = IIf(Ref(L,-1) < Ref(L,-2), Ref(L,-2) - Ref(L,-1), 0);
lowDeltaSum = Sum(lowDelta, sZPeriod);
LowDeltaCount = Sum(Ref(L,-1) < Ref(L,-2), sZPeriod);
sZPoint = Ref(L,-1) - sZK * IIf(LowDeltaCount != 0, lowDeltaSum / LowDeltaCount, 0);
sZStop = HHV(sZPoint, sZHold);

Plot(C,"",16,132);
Plot (sZStop,"",10,1);