The graph for the mean statistical volatility is off

Course Name: Aprende a programar en MQL4 desde 0, Section No: 4, Unit No: 12, Unit type: Video



I followed the steps on MQL4 to calculate the statistical volatility along with the mean, however, when I get it in MT4 the width doesn't allow me to see the histogram for the volatility. I attach a picture in the folder of the link with the code I use. Any assistance would be highly appreciated. Thanks!



Logré seguir los pasos para calcular la volatilidad estadistica y la media, sin embargo cuando lo pongo en metatrader la media tiene un ancho gigante que no deja ver el histograma, adjunto una foto en la carpeta. Vi los videos varias veces y creo que el código es el mismo, no se si alteré algo en la configuración. Si puede proveer asistencia al respecto se lo agradeceria. Saludos!

Hi Eric!



It's Marti. First of all, I hope you are enjoying the course.



The problem is in lines 60 and 61 of your code, inside the "SetIndexStyle" function. You have to pass all its needed arguments so it works properly. If not, you would be telling to the function that its "type" argument, which is the second one, is "NULL" instead of "DRAW_LINE" or "DRAW_HISTOGRAM".

 

//This is your actual code, in lines 60 and 61.
SetIndexStyle(0, EMPTY, EMPTY, color_vol);
SetIndexStyle(1, EMPTY, EMPTY, color_mean);

//It should be like this:
SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, EMPTY, color_vol);
SetIndexStyle(1, DRAW_LINE, EMPTY, EMPTY, color_mean);

You can find reference of this specific function here: https://docs.mql4.com/customind/setindexstyle

This should fix your problem.

Best regards,
Marti

Hi Marti. Yes! That solves the problem. Thank you so much! It's an awesome course!!! One of the best on this platform!