Hi there,
Got this strategy from Trading View and it looks all right. As my program skills stopped in the 80’s with the C64, I was wondering if somebody could convert this Pine Script into prorealtime code cheers!
Moving average deviation rate
Simple moving average deviation rate and standard deviation.
The bollinger band is momentum value standard devition.
Bat the bollinger band is not normal distribution to close price.
Moving average deviation rate is normal distribution.
This indicator is draw Moving average deviation rate and fill area 2σ standard devition.
If it exceeds 2σ, it is a trading opportunity.
//@version=3
study(“Moving average deviation rate”, overlay=false)
//input
_maPeriod = input(21, title=”Moving average period”)
//deviation rate
_sma = sma(close, _maPeriod)
_rate = close / _sma * 100 – 100
//deviation rate std
_stdCenter = sma(_rate, _maPeriod * 2)
_std = stdev(_rate, _maPeriod * 2)
_plusDev = _stdCenter + _std * 2
_minusDev = _stdCenter – _std * 2
plot(_rate, color=red)
_plotCenter = plot(_stdCenter, color=green)
_plotPlus = plot(_plusDev, color=green)
_plotMinus = plot(_minusDev, color=green)
fill(_plotCenter, _plotPlus, color=green)
fill(_plotCenter, _plotMinus, color=green)