Directional Volatility indicator. The indicator displays two volatility lines – bullish and bearish ones.
It has two configurable parameters:
- Period – calculation period
- Deviation – deviation
It is calculated with the standard deviation from a mean of the last X Period, made of distance between the last Close with the High/Low depending of the direction (short or long curves).
Converted from a mq5 indicator by a request in the English forum.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
//PRC_DirectionalVolatility | indicator //27.11.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- settings Period= 20 Deviation= 2 // --- end of settings ShortS = Close[1] - Low ShortMA = average[Period](ShortS) ShortDev = Std[Period](ShortMA) LongS = High - Close[1] LongMA = average[Period](LongS) LongDev = Std[Period](LongMA) Short = ShortMA + Deviation * ShortDev Long = LongMA + Deviation * LongDev return Short coloured(255,0,0), Long coloured(0,255,0) |
Share this
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thanks for this great addition. How would you “finish the syntax” if you were to use an ALMA moving average? Tried adding the ALMA code and Calling it. Please see code where I have used “///////////” for syntax issue. Thanks,
Problems with Safari latest s/ware and this site and links and adding code.
Let me add the code here:
https://www.dropbox.com/s/6w4266gmwlaszf9/DirectionalVolatilityALMA.rtf?dl=0
Ok thanks Nicolas – could this be adapted to take into account MFI and then have price, volume and vola bands around the current price bars on the chart at all?
I don’t understand what you mean exactly, would be better to open a topic about this idea with a complete explanation; so I would be able to help much better.