This can happen if start of your EA got a tick but has no history yet.
I check for Tickvalue to be greater 0 or check Bars > 100
What do you mean by "start of your EA got a tick but has no history yet"? The EA was running since Monday so the start of the EA is Monday, today is Wednesday when the error happened. I don't fully understand how no history yet. Can you please explain it?
Surely the chart has more than 100 bars. The EA worked before on same chart. The error happens randomly.
Thanks
I mean if you start the terminal with charts with EAs and/or indicators. They all could get a tick while all the information from the server has not been loaded - kind of thread race.
If it happens randomly may be the quotes of the broke have 'wholes'?
Print(..) the necessary information in those cases!
Are you sure that you do not have a similar block of code elsewhere?
I don't believe that a print of a calculation using doubles can print as -0, it would be printed as something like -1e015, if it was exactly zero, it would print as 0.0
I mean if you start the terminal with charts with EAs and/or indicators. They all could get a tick while all the information from the server has not been loaded - kind of thread race.
If it happens randomly may be the quotes of the broke have 'wholes'?
Print(..) the necessary information in those cases!
Are you sure that you do not have a similar block of code elsewhere?
I don't believe that a print of a calculation using doubles can print as -0, it would be printed as something like -1e015, if it was exactly zero, it would print as 0.0
Are you sure that you do not have a similar block of code elsewhere?
I don't believe that a print of a calculation using doubles can print as -0, it would be printed as something like -1e015, if it was exactly zero, it would print as 0.0
Yes I'm sure. It's just this code I have.
I can suggest nothing. The prints that you show should not be possible from that code.
Maybe you should show the whole code.
I can suggest nothing. The prints that you show should not be possible from that code.
Maybe you should show the whole code.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I wonder if someone could help me out. It's driving me crazy.
I have the following code:
This is the print screen:
The values Open and Close for the previous candle and previous of previous candle are wrong.
If I stop the EA and run it again for same, it works as expected:
I initiate the code only once per bar:
Any idea why Open and Close values for [1] and [2] might be wrong? This doesn't happen always though, it happens randomly.
Thanks