Trend Lines, Supports and Resistances

ismailcarlik Updated   
This is a simple script that draws trend lines, supports and resistances based on the highs and lows of pivots and is developed solely for practice purposes while learning the Pine Script language.

  • Ability to change pivot length and mark pivots on chart.
  • Ability to change amount of pivot points that used to generate trend lines or support and resistances.
  • Ability to set exception for last "n" bars for breaks.
  • Ability to set exception up to "n" times for breaks.
  • Ability to see broken trend lines as ghosts.
  • Ability to set alarms for breaks.
  • Ability to change colors and line widths.
  • And many more...

Trading is risky and most of the day traders lose money eventually. This indicator is only for educational purposes and should not be construed as financial advice. Past performances does not guarantee future results.
Release Notes:
Fixed bugs at alert texts.
Release Notes:
Added options for alert frequencies.

  • "Once Per Bar": The first function call during the bar triggers the alert.
  • "Once Per Bar Close": The function call triggers the alert only when it occurs during the last script iteration of the real-time bar, when it closes.
  • "All": All function calls trigger the alert.
Release Notes:
Added alerts for new pivot highs and lows which may be possible supports and resistances.

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.


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?