Hello, I was asked to write code in MQL5, I used to work with it a little, only on MQL4.
I encountered an error that I didn’t understand. There is a code that translates 6 arrays into the buffer of the basement indicator and outputs a value for each given one (in my example, this is 10,20,30,40,50,60). The essence of the code is to draw these lines with each new candle, i.e. at the time of setting the line only on the current bars, then their length will gradually increase, in theory everything is simple. This code works perfectly on MT4, and then a strange thing happens to me-all the lines after the next compilation, the appearance of a new candle or changing the settings, begin to redraw by incomprehensible values, half of the buffers become completely empty, their length becomes different. The error does not appear immediately and I can not understand what could be the cause.
I will attach the code that I am testing, as well as screenshots:
How should be1, How should be2 – how should the indicator display these lines.
Error 1,2,3 – what happens on the chart after the actions described above.
I ask people who understand MT5 to help. Perhaps somewhere you need to update the data of the array, or I have the type of lines is not so set, there are no even guesses, I sin on the MT5 bug.
I tried 2 different terminals, downloaded the newest ones.
zy. 2 more times there was a moment when throwing the indicator on the chart, he began to calculate something furiously, rebuild the lines and so on for about a minute, then calmed down.
rever27
can you write more details?
My goal is for the buffer to store all the information in itself from the moment the indicator is installed until it is removed from the chart.
when initializing, i clean the array twice: arrayfree and arrayinitialize(signal,empty_value);
while the code is running, i can’t reset it, otherwise all the data that has been in memory since the installation will be erased.
nektomk
The default buffer indexing is different in 4 and 5.
5 ka does not reset the data for the programmer.
Just a little more careful you need to be and happiness will come