Questions from Beginners MQL5 MT5 MetaTrader 5 - page 195
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Look again at the indicator code from the help https://www.mql5.com/ru/docs/indicators/ima . Note the lines in OnInit():
This creates the indicator handle for the period - "period".
Good afternoon.
I'm trying to get the last value of a fractal:
Handle[Number]=iFractals(Symbol_,0);
CopyBuffer(Handle[Number],UPPER_LINE,4,100,Upper)
upenv[Number]=Upper[0];
but sometimes I get some strange number upenv[Number]=1.797693134862316e+308
If this number were 0, the problem would be solved this way
if(upenv[Number]=Upper[0] && Upper[0]!=0)
upenv[Number]=Upper[0];
Where is my mistake? What am I doing wrong? How can I get the last value of the fractal before it changes?
Once again you should look through the indicator code from https://www.mql5.com/ru/docs/indicators/ima . Note the lines in OnInit():
This is where theindicator handle for the periodis created- "period".
I have found error in the array size, it was my main error from initial code. I can't understand why the terminal chart behaves inadequately (blurs, updates, shifts, etc.). Thanks.
You have created an indicator handle at every tick (i.e. in the OnCalculate() function. This is not correct. Indicator handle should be created in OnInit().
All found error in array size, that was my main error in original code. But why does the terminal chart behave inadequately (blinks, updates, shifts, etc.). Thanks.
You have created an indicator handle at every tick (i.e. in the OnCalculate() function. This is not correct. Indicator handle must be created in OnInit().
And if I need MACD readings in an indicator (M1;M5;M15;H1;H4;D1;W1), then I need to create a handle for each period?
Yes, make as many indicator handles as needed in OnInit.
All found error in array size, that was my main error in original code. But why does the terminal chart behave inadequately (blinks, updates, shifts, etc.). Thanks.
You have created an indicator handle at every tick (i.e. in the OnCalculate() function. This is not correct. Indicator handle must be created in OnInit().
It's more likely that the M15 chart uses D1 data, or I'm wrong.
You create an indicator handle on each tick (i.e. in OnCalculate()). This is incorrect. The indicator handle should be created in OnInit(). On the M15 chart, you can use the data from D1. However, in this case, the data may be incomplete - read "Organizing data access" https://www.mql5.com/ru/docs/series/timeseries_access.