LazyBear

ValueChart Indicator [LazyBear]

3508 33 373
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) => 
    y=abs(round(i))
    s[y]

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)
List of my free indicators: http://bit.ly/1LQaPK8
List of my indicators at Appstore: http://blog.tradingview.com/?p=970

grahvity
2 years ago
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 years ago
Nightmoded: https://www.tradingview.com/e/ZTP27Nrx/
snapshot
+1 Reply
LazyBear PRO grahvity
2 years ago
Thx grahvity.
+1 Reply
TheLark PRO
2 years ago
Very nice
Reply
LazyBear PRO
2 years ago
Thanks @TheLark.

For some reason when I press "Reply" on your original msg, it reloads the page for me. Weird bug.
Reply
Ameliia Diukre
2 years ago
Hello, guys! Help me please with some information about Alphala Corp. (ALPC)? Want more information but can't find. Thanx!
Reply
AlexandreFF
2 years ago
Thanks again LazyBear ! You're the master of the tradingview scripts
Reply
LazyBear PRO AlexandreFF
2 years ago
YW :)
Reply
A
2 years ago
Thank you LazyBear, i was hoping someone would code this. : D
Reply
LazyBear PRO A
2 years ago
YW.
Reply
LastBattle
2 years ago
Thanks. Pretty cool!
Reply
LazyBear PRO LastBattle
2 years ago
yw :)
Reply
glaz
2 years ago
the original recalculates and has about 70% correct signals, its the same here ?
+1 Reply
LazyBear PRO glaz
2 years ago
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
2 years ago
@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
LazyBear PRO TheLark
2 years ago
Interesting! Thanks for the info @TheLark.
+1 Reply
TheLark PRO LazyBear
2 years ago
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
TheLark PRO TheLark
2 years ago
oops nvm, I just read your comment in the description
+1 Reply
TheLark PRO LazyBear
2 years ago
Bars *ARE* recalculated, so since my initial tests are not walk forward, the 70% results are definitely skewed.
+1 Reply
LazyBear PRO TheLark
2 years ago
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
2 years ago
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
TheLark PRO TheLark
2 years ago
I should rephrase highest/ lowest to "indicator extremes"
+1 Reply
LazyBear PRO TheLark
2 years ago
I have pinged TV developers, will know soon if Pinescript engine does this.
Reply
TheLark PRO LazyBear
2 years ago
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
LazyBear PRO LazyBear
2 years ago
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
LEONES PRO
2 years ago
Good job, what is the time frame for this value chart?
Reply
LazyBear PRO LEONES
2 years ago
@TheLark found M15 effective (see his comment above).
Reply
LEONES PRO LazyBear
2 years ago
yes this is the Mark Heldweg indicator
Reply
LEONES PRO LEONES
2 years ago
http://www.valuecharts.com/products.html
+1 Reply
LEONES PRO LazyBear
2 years ago
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.
Thanks!
Reply
risa
a year ago
Super. Thank you.
Reply
telepatico
7 months ago
prev(s,i) =>
y=abs(round(i))
s
What are the values for i and s? Thanks.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener 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 Billing Sign Out