Ni6HTH4wK

[LAVA] Relative Price Difference

This script shows the relative price difference based off the last high and low, so many bars ago. Bollinger bands are also included by default for closer inspection on the intensity of the movement or the lack thereof. Bollinger bands will follow the smoothed line which will allow the reactionary line to cross the boundary during an intense movement. With the colors selected, a gray color will appear after the color to the zero line to announce a deep correction is possible. Buy/Sell indicators show up as crosses to indicate when the price is moving in a certain direction. Sideways stagnation will have several crosses due to the close proximity to the zero line.

I use 21 in the demo here without the bollinger bands or buy/sell indicators to show the power of the script to identify bottoms and tops using the tips and hand drawn trendlines.

(This script is actually the same script as before, but listed here as the final version. Hopefully this will be my last update with this script.)

If you use and enjoy this script, please like it!
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?
study(title="[LAVA] Relative Price Difference", shorttitle="RPD_L")
len = input(14, minval=1, title="Length")
mult = input(2.0, minval=0.001, maxval=50)

high_ = highest(high, len*3)
low_ = lowest(low, len*3)
RPD = 100 - 100/(1 +((high/high_) - (low_/low)))
SRPD = swma(RPD)

dev = mult * stdev(SRPD, len*2)
upper = SRPD + dev
lower = SRPD - dev

p0 = plot(0.000001, color=black)
p1 = plot(upper, style=area, color=#FF8400, transp=65)
p2 = plot(lower, style=area, color=#007BFF, transp=65)

plot(SRPD, title="SRPD", color=red, linewidth=2)
plot(RPD, title="RPD", color=lime, linewidth=1)

LOOKUP = (cross(SRPD,1) or cross(SRPD,-1) or cross(SRPD,-1)[1]) and SRPD>SRPD[1] and SRPD[1]>SRPD[2] ? -1.5 : na
LOOKDN = (cross(SRPD,-1) or cross(SRPD,1) or cross(SRPD,1)[1]) and SRPD<SRPD[1] and SRPD[1]<SRPD[2] ? 1.5 : na
plot(LOOKUP, title="Bingo", style=cross, linewidth=3, color=green)
plot(LOOKDN, title="Bingo", style=cross, linewidth=3, color=red)