Ni6HTH4wK

Relative Price Difference [LAVA]

744 11 43
EDIT: Look below for updates to the script.

EDIT: After several updates to this script, I think it's safe to say it will work with all timelines. Using hand drawn trendlines , it can predict tops and bottoms with pretty good accuracy.

Shows a change in the relative price difference via percentage on a 0 horizontal. Added a bollinger band to help identify weak areas (orange). If orange starts showing, the current price direction is strong but can reverse harshly. If you are in a weak position, exit here. Otherwise, don't enter a trade after/during orange sessions until a full cycle (up/dn > 1% without orange) has completed. The main line indicator fluctuates according to the price difference. 1% horizontal lines are added to help identify profit taking spots or OTE             zones. Ensure the 1% line is crossed completely before you decide to enter/exit. Cross points are identified with crosses if you missed your window, this is the last spot to exit, enter. This indicator doesn't work that well with small time intervals. As always, use more than one indicator to ensure your decision is right. (The colors are ugly so change them if you wish! :)
Remove from Favorite Scripts Add to Favorite Scripts
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)
zero = 0.000001

hi = (high/highest(len))*100
lo = (low/lowest(len))*100
opens = (open+open[len])/2
closes = (close+close[len])/2
raw = open>close ? hi-lo : lo-hi
smoothed = swma(raw)
RPD = vwma(smoothed,len/2)
dev = mult * stdev(RPD, len)
upper = RPD + dev
lower = RPD - dev

plot(RPD, color=aqua)
hline(1, title='top line', color=#303030, linestyle=dotted, linewidth=1)
hline(-1, title='top line', color=#303030, linestyle=dotted, linewidth=1)

p0 = plot(zero, color=black)
p1 = plot(upper, color=black)
p2 = plot(lower, color=black)
fill(p0, p1, color=yellow, transp=70)
fill(p0, p2, color=red, transp=70)

LOOKUP = cross(RPD,zero) ? 1.2 : na
LOOKDN = cross(RPD,zero) ? -1.2 : na
plot(LOOKUP, title="Bingo", style=cross, linewidth=2, color=gray)
plot(LOOKDN, title="Bingo", style=cross, linewidth=2, color=gray)
The above is an improvement to the original with only a single bar delay without volume weighting.
Reply
Ni6HTH4wK PRO Ni6HTH4wK
2nd update is to move the plot above the fills if they were solid... don't think it worked. And also to change the color of the crossover cross to give an easier indication which way the trend is going.
Reply
Ni6HTH4wK PRO Ni6HTH4wK
3rd Update - Change the colors and modified the RPD evaluation to be a lot simpler and CPU efficient. Also, buy and sell crossover's happen less often now.
Reply
mucalov Ni6HTH4wK
Great work! Thanks for sharing.
+1 Reply
Ni6HTH4wK PRO Ni6HTH4wK
4th Update - Modified the bingo indicators... they still don't work that well so remove them if they get annoying.
Reply
Ni6HTH4wK PRO Ni6HTH4wK
5th Update - Changed the formula to better match my intentions. Now I am using the same RSI formula but substituting the HL2 with the relative price data.
Reply
study(title=" Relative Price Difference", shorttitle="RPD_L")
len = input(14, minval=1, title="Length")
mult = input(2.0, minval=0.001, maxval=50)
zero = 0.000001

hi = (highest(len)/high)*100-100
lo = (lowest(len)/low)*100-100
closing = (close/close)*100-100
raw = open>close ? closing-hi : closing-lo
RPD = swma(raw)
dev = mult * stdev(RPD, len*2)
upper = RPD + dev
lower = RPD - dev

plot(RPD, color=aqua)
hline(1, title='top line', color=#303030, linestyle=dotted, linewidth=1)
hline(-1, title='top line', color=#303030, linestyle=dotted, linewidth=1)

p0 = plot(zero, color=black)
p1 = plot(upper, color=black)
p2 = plot(lower, color=black)
fill(p0, p1, color=yellow, transp=70)
fill(p0, p2, color=red, transp=70)

LOOKUP = cross(RPD,zero) ? 1.2 : na
LOOKDN = cross(RPD,zero) ? -1.2 : na
plot(LOOKUP, title="Bingo", style=cross, linewidth=2, color=gray)
plot(LOOKDN, title="Bingo", style=cross, linewidth=2, color=gray)
Reply
Ni6HTH4wK PRO Ni6HTH4wK
study(title=" Relative Price Difference", shorttitle="RPD_L")
len = input(14, minval=1, title="Length")
mult = input(2.0, minval=0.001, maxval=50)
zero = 0.000001

hi = (highest(len)/high)*100-100
lo = (lowest(len)/low)*100-100
closing = (close/close)*100-100
raw = open>close ? closing-hi : closing-lo
RPD = swma(raw)
dev = mult * stdev(RPD, len*2)
upper = RPD + dev
lower = RPD - dev

p0 = plot(zero, color=black)
p1 = plot(upper, color=black)
p2 = plot(lower, color=black)
fill(p0, p1, color=yellow, transp=70)
fill(p0, p2, color=red, transp=70)

plot(RPD, color=aqua)
hline(1, title='top', color=#303030, linestyle=dotted, linewidth=1)
hline(-1, title='bot', color=#303030, linestyle=dotted, linewidth=1)

LOOKUP = cross(RPD,zero) and RPD>RPD ? -1.2 : na
LOOKDN = cross(RPD,zero) and RPD<RPD ? 1.2 : na
plot(LOOKUP, title="Bingo", style=cross, linewidth=2, color=green)
plot(LOOKDN, title="Bingo", style=cross, linewidth=2, color=red)
Reply
Ni6HTH4wK PRO Ni6HTH4wK
study(title=" Relative Price Difference", shorttitle="RPD_L")
len = input(14, minval=1, title="Length")
mult = input(2.0, minval=0.001, maxval=50)
zero = 0.000001

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

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

p0 = plot(zero, color=black)
p1 = plot(upper, color=black)
p2 = plot(lower, color=black)
fill(p0, p1, color=#FF8400, transp=75)
fill(p0, p2, color=#007BFF, transp=75)

plot(RPD, title="RPD", color=aqua, linewidth=2)
plot(SRPD, title="SRPD", color=teal, linewidth=1)
hline(1, title='top', color=#303030, linestyle=dotted, linewidth=1)
hline(-1, title='bot', color=#303030, linestyle=dotted, linewidth=1)

LOOKUP = cross(RPD,zero) and RPD>RPD ? -1.2 : na
LOOKDN = cross(RPD,zero) and RPD<RPD ? 1.2 : na
plot(LOOKUP, title="Bingo", style=cross, linewidth=2, color=green)
plot(LOOKDN, title="Bingo", style=cross, linewidth=2, color=red)
Reply
Ni6HTH4wK PRO Ni6HTH4wK
study(title=" 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 = ((high/high_) - (low_/low))*100
SRPD = swma(RPD)

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

p0 = plot(0.000001, color=black)
p1 = plot(upper, color=black)
p2 = plot(lower, color=black)
fill(p0, p1, color=#FF8400, transp=75)
fill(p0, p2, color=#007BFF, transp=75)

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)) and SRPD>SRPD and SRPD>SRPD ? -1.5 : na
LOOKDN = (cross(SRPD,-1) or cross(SRPD,1) or cross(SRPD,1)) and SRPD<SRPD and SRPD<SRPD ? 1.5 : na
plot(LOOKUP, title="Bingo", style=cross, linewidth=3, color=green)
plot(LOOKDN, title="Bingo", style=cross, linewidth=3, color=red)
Reply
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
Việt Nam
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Priority Support Contact Support Ideas Published Followers Following Private Messages Chat Sign Out