Directional Volatility indicator. The indicator displays two volatility lines – bullish and bearish ones.
It has two configurable parameters:
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.
//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)