ValueChart Indicator [LazyBear]

This indicator displays the trend-adjusted price activity of a security. It oscillates around the zero-line. It is usually plotted as OHLC, but Pine doesn't have this support yet. So, I have rendered OHLC separately (see chart for the details).

This indicator is particularly useful for ‘scalping’ in a sideways market, where there is limited movement taking place, rather than a trending market undergoing larger swing movements.

I am not sure how much this resembles the commercial indicator out there as I don't have access to one. This is a direct port of a similar TOS indicator.

Removed direct links.
Remove from Favorite Scripts Add to Favorite Scripts
// @author LazyBear
// If you use this code in its original/modified form, do drop me a note. 
study("ValueChart Indicator [LazyBear]", shorttitle="ValueChart_LB")

prev(s,i) => 

length = input(5, title="Number of bars")
extTop = input(12, title="Extreme Level Top")
extBot = input(-12, title="Extreme Level Bottom")
sigTop = input(8, title="Significant Level Top")
sigBot = input(-8, title="Significant Level Bottom")
fairTop = input(4, title="Fair Value Top")
fairBot = input(-4, title="Fair Value Bottom")

ext_l = plot(extTop,title="Extreme Top Line",color=red)
exb_l = plot(extBot,title="Extreme Bottom Line",color=red)
top_l=plot(sigTop,title="Top Chart Line",color=red, style=3)
bot_l=plot(sigBot, title="Bottom Chart Line",color=red, style=3)
tm_l=plot(fairTop,title="Top Mid Chart Line",color=gray)
bm_l=plot(fairBot,title="Bottom Mid Chart Line",color=gray)
fill(ext_l, top_l, red)
fill(exb_l, bot_l, red)
fill(top_l, tm_l, yellow, transp=80)
fill(bot_l, bm_l, yellow, transp=80)
fill(tm_l, bm_l, green, transp=85)

varp = round(length/5)
h_f = length > 7

vara=h_f ? highest(high,varp)-lowest(low,varp) : 0
varr1 = h_f ? iff(vara==0 and varp==1,abs(close-prev(close,-varp)),vara) : 0
varb=h_f ? prev(highest(high,varp),-varp+1)-prev(lowest(low,varp),-varp) : 0
varr2 = h_f ? iff(varb==0 and varp==1,abs( prev(close,-varp)-prev(close,-varp*2) ),varb) : 0
varc=h_f ? prev(highest(high,varp),-varp*2)-prev(lowest(low,varp),-varp*2) : 0
varr3 = h_f ? iff(varc == 0 and varp==1,abs(prev(close,-varp*2)-prev(close,-varp*3)),varc) : 0
vard = h_f ? prev(highest(high,varp),-varp*3)-prev(lowest(low,varp),-varp*3) : 0
varr4 = h_f ? iff(vard == 0 and varp==1,abs(prev(close,-varp*3)-prev(close,-varp*4)),vard)  : 0
vare = h_f ? prev(highest(high,varp),-varp*4)-prev(lowest(low,varp),-varp*4) : 0
varr5 = h_f ? iff(vare == 0 and varp==1,abs(prev(close,-varp*4)-prev(close,-varp*5)),vare) : 0
cdelta = abs(close - prev(close,-1))
var0 = (not h_f) ? iff((cdelta > (high-low)) or (high==low),cdelta,(high-low)) : 0
lrange=h_f ? ((varr1+varr2+varr3+varr4+varr5)/5)*.2 : sma(var0,5)*.2

mba = sma( (high+low)/2,length)
vopen = (open- mba)/lrange
vhigh = (high-mba)/lrange
vlow = (low-mba)/lrange 
vclose = (close-mba)/lrange 
plot(vhigh, color=maroon, linewidth=1)
plot(vopen, linewidth=2, color=green)
plot(vclose, linewidth=2, color=vclose > vopen ? blue : red, style=3)
plot(vlow, color=maroon, linewidth=1)
Thanks LazyBear. I highly recommend watching the video in the link you posted.
I'm going to give this one a try and share any profits I realize.

I've said it before, you deserve some sort of special distinguishment here for your contributions. A MOD badge or free PRO account, for example. Just a thought.
+2 Reply
grahvity grahvity
+2 Reply
Thx grahvity.
+1 Reply
Very nice
Thanks @TheLark.

For some reason when I press "Reply" on your original msg, it reloads the page for me. Weird bug.
Hello, guys! Help me please with some information about Alphala Corp. (ALPC)? Want more information but can't find. Thanx!
Thanks again LazyBear ! You're the master of the tradingview scripts
LazyBear PRO AlexandreFF
YW :)
Thank you LazyBear, i was hoping someone would code this. : D
Thanks. Pretty cool!
LazyBear PRO LastBattle
yw :)
the original recalculates and has about 70% correct signals, its the same here ?
+1 Reply
AFAIK, "recalculate" (or repaint) shouldn't happen. I will let somebody who uses this indicator regularly to comment on the "70% correct" query.
+1 Reply
TheLark PRO LazyBear
@glaz @lazybear I coded this where I could run backtests, it is capable of 70% correct signals depending on usage and agg. 15m worked nicely
+1 Reply
Interesting! Thanks for the info @TheLark.
+1 Reply
TheLark PRO LazyBear
np LB, thanks for the tip here, I was unaware of this indicator. Where did you get the calc for it? Was it reverse engineered?
+1 Reply
oops nvm, I just read your comment in the description
+1 Reply
TheLark PRO LazyBear
Bars *ARE* recalculated, so since my initial tests are not walk forward, the 70% results are definitely skewed.
+1 Reply
shucks, thats disappointing!

By "recalculate", you mean the previously calculated values actually change..correct? This is confirmed by a TV developer?
+1 Reply
TheLark PRO LazyBear
Yes past data changes, I need to look more closely at the calculation when I have a minute, but the data is probably being normalized based on highest highs and lowest lows to fit within a range, if so, past data changing would not be uncommon.

I witnessed the values change on another platform, the code was an exact port of yours
+1 Reply
I should rephrase highest/ lowest to "indicator extremes"
+1 Reply
I have pinged TV developers, will know soon if Pinescript engine does this.
TheLark PRO LazyBear
That was a partial false alarm on my part, didn't want to lead people astray so alerted you before I could really look into it. In my tests I was using open of the forming bar as a signal. Saw that open value moving around on the forming bar, and assumed the whole chart was being normalized to price extremes. In actuality it's calculating these bars with high, low, and close information, so the "open" does not behave the way we know typical open's to behave. So I partially take what I said back, no signal's can be taken on this indicator until a new bar has formed. I'll run some tests with this in mind and let you know how it fairs
+1 Reply
Pine indicators do not "recalculate" values for candles that already closed. I confirmed this with a TV developer.

What this means is, you will not see a change in the indicator values once they show up. Good to know :)
+1 Reply
Good job, what is the time frame for this value chart?
@TheLark found M15 effective (see his comment above).
yes this is the Mark Heldweg indicator
+1 Reply
I think it is based on a 5day average
+1 Reply
Lazy Bear, this is a great tool to use when paired up with Pivot Points! Confirms/Denies probability of price pushing through a pivot or not.
Super. Thank you.
prev(s,i) =>
What are the values for i and s? Thanks.
Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out