Re: Volatility Indicators for MT4

164
mrtools wrote: Sat Aug 14, 2021 4:12 am Added bands with a choice of atr or average range.
Image
Hello Sir, another excellent indicator to my trading algo. This show so much information for trading conviction. In 5m timeframe the volatility value doesnt change although the volatility line shown are going up/down at candle close. Is it because the digit limitation ? can it shows more than 4 digits, example 0.00015 ? thank you very much

Re: Volatility Indicators for MT4

165
polygone wrote: Tue Dec 07, 2021 2:00 pm Hello Sir, another excellent indicator to my trading algo. This show so much information for trading conviction. In 5m timeframe the volatility value doesnt change although the volatility line shown are going up/down at candle close. Is it because the digit limitation ? can it shows more than 4 digits, example 0.00015 ? thank you very much
No don't think it has anything to do with digits and don't think it can show anymore digits than what your broker offers.


Re: Volatility Indicators for MT4

166
mrtools wrote: Tue Dec 07, 2021 2:42 pm No don't think it has anything to do with digits and don't think it can show anymore digits than what your broker offers.
thank you for your reply Sir,
in that case, can the calculation value of volatility made bigger ? for example times 10 or 100
or is it impossible because of value limitation and it will mess up the chart ?
Im very sorry if I annoy you, Im genuinely asking without meaning to be a snob or trying to be condesending.

Thank you very much Sir, your help is much appreciated.

CodeRe: Volatility Indicators for MT4

167
whiplashtm wrote: Tue Dec 07, 2021 4:42 am Hi, is it possible to update directional volatility with the option to use the latest averages and prices? And would it be possible to "replace" the stdev calculation with mladens EMA deviation calclulation, and/or give the option to choose different averages for the deviation aswell (it's using SMA as standard). It would've been nice to have the indicator showing up on the entire charthistory aswell (probably because of the extcountbars code?).

Much appreciated. Take care.
Directional Volatility

Cleaned up the code and changed to Mladen's ema deviation and added the averages to the calculations.

What is the Directional Volatility indicator?

This indicator, known as Directional Volatility, utilizes the principles of volatility analysis through the application of standard deviations and moving averages. The primary objective is to compute a volatility measure and display it in the form of two separate lines, which signify upward (Long) and downward (Short) volatility trends.

The indicator works on price data, specifically the closing, high, and low prices, and is designed to be displayed in a separate window beneath the main chart.

Key concepts
  • The indicator calculates a directional volatility measure for both upward and downward movements based on price changes.
  • The volatility is determined using the difference between the closing price and the high/low prices, smoothed with exponential moving averages (EMA).
  • The indicator generates two lines: one for the Long volatility (representing upward price movement) and another for the Short volatility (representing downward price movement).
Calculation
  • The algorithm starts by calculating the differences between the closing price and low price (for Long) and between the high price and the closing price (for Short) for each bar.
  • These differences are smoothed using an Exponential Moving Average over the specified period.
  • Then, the standard deviation of the smoothed values is calculated using a Simple Moving Average for volatility.
  • Finally, the volatility is adjusted by multiplying the standard deviation with the Deviation parameter, and the values are stored in the Long[] and Short[] buffers.
  • Final values are divided by Point to adjust them to the market's price scale.
This MQL4 code, in essence, computes volatility by analyzing price variations derived from high, low, and close values, which are then smoothed using Exponential Moving Averages. It employs standard deviation for scaling purposes and displays two distinct lines that represent directional volatility in a separate window.
These users thanked the author mrtools for the post (total 12):
talaate, Jimmy, whiplashtm, andrei-1, Jackson Doh, optionhk, Krunal Gajjar, heispark, RodrigoRT7, BeatlemaniaSA, pipsquirrel, Jedidiah

Re: Volatility Indicators for MT4

169
mrtools wrote: Thu Dec 09, 2021 7:13 am Cleaned up the code and changed to Mladen's ema deviation and added the averages to the calculations.
Image
I appreciate your efforts and time for making the indicator. But could you also add a smoothing option (with fractional period and the different averages), even though it adds to the lag, I think it would be benefical to smooth out some of the jagginezz (if you use other averages than supersmoother etc.).

Re: Volatility Indicators for MT4

170
Hell Mr. Tools. Thank you very much for the Directional Volatility Averages indicator. I have a request of you. Could you please add MTF option in the indicator. Also if possible, a sound alert at the cross of the lines. Again Thanks very much.

Wishing everybody at Forex Station a very happy Christmas and a great New Year.