Strategy Idea: Previous high and low value is recorded when the crosses overBought(70) and OverSold(30) values.
Now when the crosses above the overSold range, the is matched with the compliment of previous high value. If the compliment i.e.(100-prev_rsi_high) is less than or equal to then long position is taken.
For short position, when the crosses below the overBought range, the is matched with the compliment of previous low value. If compliment i.e.(100-prev_rsi_low) is greater than or equal to .
Below s the code for the indicator present in the chart.
study(title="SB_Compliment_Relative Strength Index", shorttitle="RSI")
src = close, len = input(14, minval=1, title="Length")
up = rma(max(change( src ), 0), len )
down = rma(-min(change( src ), 0), len )
= down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
plot( , color=purple)
band1 = hline(70)
band0 = hline(30)
fill(band1, band0, color=purple, transp=90)
The code also has switch code also which means it will enter the overBrought or overSold block one after the other.
Future modifications: Currently the value of tracked is the one in which it crosses the overSold or OverBought range and not the highest/lowest value when the value is above/below OverBought/OverSold range.
Comment the perfect combination of indicators for it and will try to incorporate those indicators into it in the next version.
Message if you think of any modifications/ enhancements/ any opportunities. :)
Donations/Tips... :) -
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.