VEMA Band_v2 - 'Centre of Gravity

820 2 97
Concept taken from the MT4 indicator 'Centre of Gravity'except this one doesn't repaint.
Modified / BinaryPro 3 / Permanent Marker
Ema configuration instead of sma & centralised.
Remove from Favorite Scripts Add to Favorite Scripts
study("VEMA Band_v2", overlay=true)
long = ema(close, 21)
plot(long, color=blue, linewidth=2)
source = close
length3 = input(34, minval=1, title = "WMA Length")
atrlen = input(3000, minval=1, title = "ATR Length")
mult1 = 2
mult2 = 3
ma = ema(source, length3)
range =  tr
rangema = wma(range, atrlen)

up1 = ma + rangema * mult1
up2 = ma + rangema * mult2

dn1 = ma - rangema * mult1
dn2 = ma - rangema * mult2

color1 = black
color2 = black

u4 = plot(up1, color = color1,linewidth=1)
u8 = plot(up2, color = color2,linewidth=1)

d4 = plot(dn1, color = color1,linewidth=1)
d8 = plot(dn2, color = color2,linewidth=1)

fill(u8, u4, color=#30628E, transp=100)
fill(d8, d4, color=#30628E, transp=100)
fill(d4, u4, color=#128E89, transp=90)

//Linear regression band
nlookback = input (defval = 21, minval = 1, title = "Lookback")
scale = input(defval=1,  title="scale of ATR")
nATR = input(defval = 14, title="ATR Parameter")

//Center band
periods=input(34, minval=1, title="MA Period")
pc = input(true, title="MA BAND")

hld = iff(close > ema(high,periods)[1], 1, iff(close<ema(low,periods)[1],-1, 0))
hlv = valuewhen(hld != 0, hld, 1)

hi = pc and hlv == -1 ? sma(high, periods) : na
lo = pc and hlv == 1 ? sma(low,periods) : na
plot(avg(ema(high,periods)+2.5*(ema(high,periods)-ema(low,periods)),ema(low,periods)-2.5*(ema(high,periods)-ema(low,periods))), color=red, style=line,linewidth=1)
plot(pc and ema(high, periods) ? ema(high, periods):na ,title="Swing High Plot", color=black,style=line, linewidth=1)
plot(pc and ema(low,periods) ? ema(low,periods) : na ,title="Swing Low Plot", color=black,style=line, linewidth=1)
I really like this. With a Donchian channel its even more useful. Can you tell me how the plots are calculated and whether you found the three hour time period to be the best. I personally like the 3 hour. Does it need different parameters on the 4 hour chart? Anyway thanks very much for this beautiful work. I have some interesting mathematical ideas that you might like to take a look at.
thanks pezq, But im not a coder, Only a manipulator of what people have already created, but want something practical that fits my style of trading. Try lower the ATR Length back to 1000
United States
United Kingdom
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 Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out