Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Created by TheMightyChicken
- // Based on LazyBear's Value Chart
- study("Value Chart [TMC]", shorttitle="VC")
- // Inputs
- Over = input(true, title="Use colored candles for OB/OS?")
- Classic = input(false, title="Use classic color scheme?")
- extOB = input(12, title="Extremely OB/OS")
- sigOB = input(8, title="Significantly OB/OS")
- modOB = input(4, title="Moderately OB/OS")
- extOS = extOB*(-1), sigOS = sigOB*(-1), modOS = modOB*(-1)
- // Indicator Calculations
- middle = (((high+low)/2)+((high[1]+low[1])/2)+((high[2]+low[2])/2)+((high[3]+low[3])/2)+((high[4]+low[4])/2))/5
- scale = (((high-low)+(high[1]-low[1])+(high[2]-low[2])+(high[3]-low[3])+(high[4]-low[4]))/5)*0.2
- o = (open-middle)/scale
- c = (close-middle)/scale
- h = (high-middle)/scale
- l = (low-middle)/scale
- // Body Calculation
- bh = o>c ? o : c
- bl = o<c ? o : c
- b0 = (o>0 and c>0) or (o>0 and c<0) ? bh : (o<0 and c<0) or (o<0 and c>0) ? bl : 0
- b1 = o<0 and c>0 ? bh : o>0 and c<0 ? bl : 0
- bc0 = o>0 and c>0 ? bl : o<0 and c<0 ? bh : 0
- // Wick Calculations
- w0 = h>0 ? h : l
- w1 = h>0 and l<0 ? l : h
- wc = h>0 and l>0 ? l : h<0 and l<0 ? h : 0
- // Colors
- Overbought = lime
- Oversold = red
- Fair = silver
- Candles = Over and c>sigOB ? Overbought : Over and c<sigOS ? Oversold : Classic and o>c ? #C76B66 : Classic and o<c ? #6BA583 : Fair
- bg = white // <= change to your background's color
- bgcolor(bg, transp=0)
- // Lines
- extOb = plot(extOB, linewidth=2, color=Overbought, title="Extremely Overbought")
- sigOb = plot(sigOB, color=Overbought, title="Significantly Overbought"), plot(sigOB, linewidth=1, color=bg, style=circles)
- modOb = plot(modOB, color=Fair, title="Moderately Overbought"), plot(modOB+1, linewidth=7, color=bg, style=histogram)
- zero = plot(0, color=blue, title="Zero Line"), plot(1, linewidth=5, color=bg, style=histogram)
- modOs = plot(modOS, color=Fair, title="Moderately Oversold"), plot(modOS-1, linewidth=7, color=bg, style=histogram)
- sigOs = plot(sigOS, color=Oversold, title="Significantly Oversold"), plot(sigOS, linewidth=1, color=bg, style=circles)
- extOs = plot(extOS, linewidth=2, color=Oversold, title="Extremely Oversold")
- fill(sigOb, sigOs, silver, transp=80)
- // Candles
- plot(b0, linewidth=3, color=Candles, style=histogram, title="Body")
- plot(b1, linewidth=3, color=Candles, style=histogram, title="Body")
- plot(bc0, linewidth=3, color=bg, style=histogram, title="Cover layer")
- plot(w0, linewidth=1, color=Candles, style=histogram, title="Wick")
- plot(w1, linewidth=1, color=Candles, style=histogram, title="Wick")
- plot(wc, linewidth=1, color=bg, style=histogram, title="Cover layer")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement