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
Hello, gentlemen developers!
Can we make changes in the MQL5 compiler to at least give us a warning?
for errors of this kind in the code.
if(Flag_Exitl=true) {break;}
The comparison condition here is not correct (it should be == ), that's why it will always be break.
How to address this situation in the compiler (if it's possible at all), so that I could get less bumpy when writing code?
(I've thought it won't work, it seems like we should separate assignment and comparison in if, so the question is removed).
Variables of bool type can not be compared to true/false, but used directly (essentially it's a yes/no flag)
I get error 4401 regularly
ERR_HISTORY_NOT_FOUND
The following indicator code
will give an error right after start (if not on D1). Or rather, once you start the terminal and open the chart - put the indicator on, you will get an error. If the terminal is not closed, then there will not be such an error at start.
But after some time (a couple of hours - 2 hours were enough for me) we will see that we will get the error on the already open chart. (I ran it on m30)
..error 4401 appears regularly.
reference:
Organising data access
Data Accessibility
Availability of data in HCC format or even in HC ready-to-use format does not always mean the unconditional availability of these data for display on a chart or for use in mql5-programs.
When accessing the price data or indicator values from mql5-programs, we should remember that it is not guaranteed to be available at a certain moment of time, or from a certain point in time. This has to do with the fact that MetaTrader 5 does not store the full copy of the required data for mql5-program, but gives direct access to the terminal database in order to save resources.
The price history for all timeframes is built from the common data in HCC format and any update of the server leads to the data update for all timeframes and indicator recalculation. Therefore, the access to the data may be denied even if the data was available just a moment ago.
CopyRate
When requesting data from the indicator, if the requested timeseries haven't been built or they need to be downloaded from the server, the function will return -1 immediately, but the process of downloading/building will be initiated.fact sheet:
Looks like it should be. Up to CopyRate SERIES_SYNCRONIZED you can check...I'm just sprinkling ashes on my head, yeah. Thank you.
Although it's strange to see the request for two bars and history unavailable, although only zero bar changes. But never mind - if it's described in the documentation, it's not an error
in my IsNewBar there was an error coming out.
Instead of
I should have written
And I was wondering why every couple of hours IsNewBar(PERIOD_D1) == true -> hence I found out about history inaccessibility, but I couldn't think of a function I wrote a year or two ago.
Why the indicator cannot handle colour types (COLOR_ARROW, etc.) with more than one buffer
code sample
We set two DRAW_COLOR_ARROW (buf1 and buf2) and for each one additional colour buffer (clr1, clr2)
At the same time, though the second buffer buf2 gets High/Low bars, it doesn't show up on the chart. It seems that colour of arrows in this buffer = clrNONE. That is, colour setting in clr2 buffer does not work
here is a screenshot. only values of buf1/clr1 are visible. values of the second buffer are not displayed with colour though values are received.
Where is error?
The question was simply created to answer "in MQL5 DNA".
Such nonsense also on DRAW_FILLING and even on relatively normal DRAW_HISTOGRAM2 (not so stable of course, but bugs occur).
Just from the instability of bugs, I conclude that you are unlikely to get an answer without a CD.
Bild 642 for Win32
Some problem with three-dimensional arrays of double appears if you by mistake go beyond the array limits when outputting in the Print function
The script goes into an infinite loop by itself.
Bild 642 for Win32
some problem with three-dimensional arrays double appears if you by mistake step outside the array when outputting in the Print function
Actually, the overrun occurs two lines earlier
and you're calling an exponent from a non-existent element, most likely zero.
Look in the log
Generally, the out-of-bounds occurs two lines earlier
and you're calling an exponent from a non-existent element, most likely zero.
look in the log