OPEN-SOURCE SCRIPT
Price Swing Indicator

This indicator shows you the highs and lows of the previous "X" amount of bars. This is an objective way of identifying previous price swings. For example, an input of "10" will show you the Swing High (SH) of the previous 10 bars and the Swing Low (SL) of the previous 10 bars. The higher the number, the higher number of bars included in the calculation. Therefore, the higher the number, the less "noise" taken into consideration. This means that higher input values will not take into consideration smaller retracements. Lower input values will take into account small retracements within larger movements.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.