SatoshiYoshimura

Swing Highs and Lows (version 2)

My second version of plotting Swing Highs and Swing Lows
A Swing High (SH): a price bar high preceed by two lower highs (LH) and followed by two lower highs (LH)

This version enables you to ignores swing highs and lows when the market volatility is small and not suitable for trading.
Thus it will depict fewer number of SH and SL markers, making the chart a bit cleaner and easier for us to read.
Volatility is measured simply by the amount of pips moved within five consecutive bars: the default is set at 10 pips, meaning that when you take five consecutive bars and the gap of the highest high and the lowest low is less than or equal to 10 pips, it will not depict SH or SL markers.
To use this function, check "set volatility threshold?" box under the Format icon and set a threshold in pips.
(I typically trade EURUSD so the pips input is customized for that)
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?