Nicolas

Directional Volatility

Category: Indicators By: Nicolas Created: November 27, 2018, 10:15 AM
November 27, 2018, 10:15 AM
Indicators
4 Comments
Directional Volatility

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.

//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)

 

Download
Filename: PRC_DirectionalVolatility.itf
Downloads: 411
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

grimweasel47
7 years ago
#

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?

Nicolas
7 years ago
#

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.

Bard
7 years ago
#

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

Bard
7 years ago
#

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,

ProRealCode ProRealCode
Loading...