Errors, bugs, questions - page 2723
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
Can you tell me what's wrong and how to speed up the chart update? The ChartRedraw function is called from the Expert Advisor, but there is still a couple of minutes delay.
ChartRedraw is needed only for drawing (updating) of graphical objects, we don't need ChartRedraw for a normal indicator that draws by indicator buffers
i think you should look for the problem in the indicator, maybe the calculation of buffers on every tick is not correct, there are "authors" who calculate the whole history every tick
ZZY: I can not confirm, but maybe ChartRedraw updates the entire chart with synchronized history, if so, you actually restart the indicator with a full calculation of the entire history every time
UPD: try to limit the history on the chart to a smaller number of bars 10 000 is enough, in MT4 there was a case where a heavy indicator "gobbled up" all the memory and then searched why EA did not work correctly (it worked then not). Although in MT5 it is unlikely that all memory was used.... but it happens
ChartRedraw is needed only for drawing (updating) of graphical objects, you don't need ChartRedraw for a normal indicator that draws by indicator buffers
i think you should look for the problem in the indicator, maybe the calculation of buffers on every tick is not correct, there are "authors" who calculate the whole history every tick
ZZY: I can not confirm, but maybe ChartRedraw updates the entire chart with synchronized history, if so, then every time you restart the indicator with a full calculation of the entire history
UPD: try to limit the history on the chart to a smaller number of bars 10 000 is enough, in MT4 there was a case where a heavy indicator "gobbled up" all the memory and then searched why EA did not work correctly (it worked then not). Although in MT5 it is unlikely that all memory is used.... but it may happen.
I've tried to optimize the calculation and have tested the previous version of the indicator. I've calculated every 1000 bars before and now I'm waiting for new bar to open.
If this is the reason, I should still be very surprised. 1k bars of not very strong calculations slows down the chart drawing for 2 minutes?
If that's the reason, it's still worth a big surprise. 1 bar of not very strong calculations slows down the chart drawing for 2 minutes?
it can not be, in my opinion, the terminal will unload such an indicator with a message saying "too long calculation in xxx indicator ".
the MT runtime (4/5) is very fast, of course you can calculate the same data several times, but imho, you have to try it hard
I think the author of the indicator is not familiar with economic calculation of indicator buffers, and forgets to calculate the last bars correctly... go to QB to study how indicators are written ;)
Are these two programs in the same terminal or in two different terminals?
The code to reproduce the problem is posted here. https://www.mql5.com/en/forum/332849
You need to run the code at least 2 times to reproduce it.
Not necessary at all. Why C? How about C#? - It's closer to C# in terms of meaning.
Probably because µl c++ is similar, and structures came there from c.
All the talk about passive structures is all archaic notions, imho.
If you need constructors, use classes or go to Sharp. Why should we deprive the structures of this connotation? This will only make programs more expressive. I may take somebody's code and see that he/she has a structure instead of a class and get a lot of information from just one word. You will get nothing, you will diligently study the source code to get the same result, which I got in a blink of an eye. In my experience - this convention of structures is respected, well maybe some sort of wind-up nihilistic marginalism.
I believe that, at a minimum, every type should have a constructor. Uninitialized fields are evil and should be avoided.
No evil there, it seems to you. Vaughn even dragged into the standard: reading of uninitialized unsigned char and std::byte is not undefinded behavior. You may use aggregate initialization for POD. And do not forget - all this initialization is not free, it's real resource consumption (CPU, memory, size of an executable). If you don't give a shit about it with your number cruncher, in case of some microcontroller it may be important. After all, C/C++ isn't just a Windows shuffle like Sharp.
The initialisation of a single variable alone increased instruction size by 30%.In one terminal. Expert writes the data, the indicator reads the data. Hanging on different charts, but obviously could be on the same one (if that matters). Build 2380.
The Expert Advisor that reads the file must keep this file closed.
The peculiarity of implementation of files in MQL5 is that they keep the data from files in their own buffers to the maximum. If the amount of information is so large that it does not fit in the buffer, then your trick of moving the pointer to the beginning and then to the end of the file can work.
So at this point, open the file, check the contents, then close it again
An Expert Advisor that reads a file must keep this file closed.
The peculiarity of files implementation in MQL5 is that they keep data from files in their own buffers as much as possible. If the amount of information is so large that it does not fit in the buffer, then your trick of moving the pointer to the beginning and then to the end of the file may work.
So at this point, open the file, check the contents, then close it again
So FileFlush () is useless?
No. FileFlush must be done if you want someone else to be able to read the modified file
The problem is that the MQL5 program reads the file into its own buffer when it opens it. It will not know anything about changes in the file until it reads it again. The file can only be read again by closing and then opening the file
No. FileFlush must be done if you want someone else to be able to read the modified file
Even if you close the file?
Even if you close the file?
That's exactly what I'm talking about. Close, then reopen
Or do you mean FileFlush before closing the file?