OPEN-SOURCE SCRIPT

Swing from stochastic with alert

1 137
Stochastic ZigZag [SH/SL] — How It Works
This indicator uses the Stochastic %K (9,3,3) to identify and confirm Swing Highs and Swing Lows on the price chart, then connects them with a ZigZag line.
Swing Detection Logic

When %K crosses below 20 → enters "seeking Low" mode, tracking the lowest price. Once %K crosses above 80, that lowest point is confirmed as a Swing Low (SL)
When %K crosses above 80 → enters "seeking High" mode, tracking the highest price. Once %K crosses below 20, that highest point is confirmed as a Swing High (SH)
If the same swing type repeats before the opposite appears, only the more extreme value is kept

Visual Output

ZigZag line connecting alternating SH and SL points (customizable color, width, style)
Tiny SH / SL labels at each confirmed swing point
Dashed horizontal level lines extending right from each confirmed SH and SL (last 3 of each shown); a level line ends at the bar where price closes through it

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.