The Perfect Support & Resistance

Support & Resistance drawn based on overbought & oversold RSI . where the overbought acts as resistance and oversold acts as support.

It has 2 levels (for support and resistance - i call them level_n_high or level_n_low) for each lookback period. it checks the highest pivot and the lowest pivot based on the lookback period then we compare if rsi is higher than the highest pivot or the lowest pivot and we also check if rsi is overbought or oversold and if the statement is true, then we assign the high to the variable level_n_high or level_n_low. n being the number of levels. in total there are 5 levels with both high & low for 5 lookback periods. This is basically how the code works.

these levels can be accessed at any timeframe. the defaults are 5m and 30m.

RSI settings: (default)
  • length - 14
  • source - close
  • overbought - 70
  • oversold - 30

lookback settings: (default)
  • lookback_0 - 200
  • lookback_1 - 100
  • lookback_2 - 50
  • lookback_3 - 20
  • lookback_4 - 10

Timeframe Settings: (default)
  • htf1 - 5m
  • htf2 - 30m

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?