Searching the internet for Volatility, I found some references to this indicator and decided to code it, adding an average to it:
I hope its formula has been correctly coded. Should you spot any mistake, please let me know.
If you prefer not to have the MA plotted, you may make it invisible with its properties, once installed in ProBuilder.
// RealVol - Realized Volatility
//Periods = 10
//MAperiods = 20
//MAtype = 0 //0=sma, 1=eama, etc...
Periods = max(1,min(999,Periods))
MAperiods = max(1,min(999,MAperiods))
MAtype = max(0,min(6,MAtype))
IF BarIndex > 0 THEN
R = Log(close) - Log(close) //or Log(close / close)
VolReal = Sqrt(summation[Periods](Square(R))) * 100
Avg = Average[MAperiods,MAtype](VolReal)
RETURN VolReal AS "Realized Volatility",Avg AS "RV Average"
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.ProRealTime ITF files and other attachments :