In case of disconnection for example, case in which it'll handle it as soon as reconnected.
Then it remains possible to limit retries, add a sleep etc...
In general using such loop without a sure way to quit is bad practice. Imagine you run your code an a broker where symbol EURUSD doesn't exist, but EURUSD.x
Yes, I mean... if there's an error retrieving the data ir should return 'false'.
Alain Verleyen:
Is it an EA, an indicator ?
You can always have a delay for the data to be ready. You can wait the next tick maybe ? Of if you want to have more control a timer. as suggested by WHRoeder/fxsaber you can also request/download the data your self.
All depends of your exact needs.
It's an EA. My goal is get data from all stock options to create a tool that helps me to create options structures.
fxsaber:
Icham Aidibe:
I don't think a 'for' is a good option. Sometimes the data is never loaded, so I would have to add an timeout, but how long it should be? I need to know if the data is not ready yet not not available all.
Henrique Vilela: Yes, I mean... if there's an error retrieving the data ir should return 'false'.
It's an EA. My goal is get data from all stock options to create a tool that helps me to create options structures.
I don't think a 'for' is a good option. Sometimes the data is never loaded, so I would have to add an timeout, but how long it should be? I need to know if the data is not ready yet not not available all.
Thank you all for the replies.
Have you found a solution?
I am always getting 0.0 calling SymbolInfoDouble(DifferentSymbol,SYMBOL_LAST) when symbol is different from chart.
Before price data become available in the MetaTrader 5 terminal, they must be received and processed. To receive data, connection to the MetaTrader 5 trade server must be established. Data are received in the form of packed blocks of minute bars from the server upon the request of a terminal. The mechanism of server reference for data doesn't...
I am always getting 0.0 calling SymbolInfoDouble(DifferentSymbol,SYMBOL_LAST) when symbol is different from chart.
Eg.
I tried reading the documentation https://www.mql5.com/en/docs/series/timeseries_access
Funny thing that even though simetimes I got SymbolInfoDouble(DifferentSymbol,SYMBOL_LASTHIGH), the of SYMBOL_LASTLOW still has 0 value.
string symbols[]={"XXXX","ZZZZ","JJJJ","TTTT"}
What's that ? If you want help please provide real information to reproduce your issue. What broker, symbols, MT5 build, where is this code running (EA, indicator..., OnInit(), OnTick()...). Also print the values in the log and show your log.
gucrepaldi: Thank you guys. I am researching it. Apparently, it's a history data issue.
You need to make sure the symbol is selected in the market watch. Once it is selected the terminal will update the broker server which will then send back the most recent tick for that symbol. This is why I used a while loop in my example -- so it can pickup the exact moment the tick arrives back from the broker server.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Yes and no.
In case of disconnection for example, case in which it'll handle it as soon as reconnected.
Then it remains possible to limit retries, add a sleep etc...
In general using such loop without a sure way to quit is bad practice. Imagine you run your code an a broker where symbol EURUSD doesn't exist, but EURUSD.x
Seems like an mql5 bug ?
Is it an EA, an indicator ?
You can always have a delay for the data to be ready. You can wait the next tick maybe ? Of if you want to have more control a timer. as suggested by WHRoeder/fxsaber you can also request/download the data your self.
All depends of your exact needs.
It's an EA. My goal is get data from all stock options to create a tool that helps me to create options structures.
I don't think a 'for' is a good option. Sometimes the data is never loaded, so I would have to add an timeout, but how long it should be? I need to know if the data is not ready yet not not available all.
Thank you all for the replies.
Yes, I mean... if there's an error retrieving the data ir should return 'false'.
It's an EA. My goal is get data from all stock options to create a tool that helps me to create options structures.
I don't think a 'for' is a good option. Sometimes the data is never loaded, so I would have to add an timeout, but how long it should be? I need to know if the data is not ready yet not not available all.
Thank you all for the replies.
Have you found a solution?
I am always getting 0.0 calling SymbolInfoDouble(DifferentSymbol,SYMBOL_LAST) when symbol is different from chart.
Eg.
I tried reading the documentation https://www.mql5.com/en/docs/series/timeseries_access
Funny thing that even though simetimes I got SymbolInfoDouble(DifferentSymbol,SYMBOL_LASTHIGH), the of SYMBOL_LASTLOW still has 0 value.
Have you found a solution?
I am always getting 0.0 calling SymbolInfoDouble(DifferentSymbol,SYMBOL_LAST) when symbol is different from chart.
Eg.
I tried reading the documentation https://www.mql5.com/en/docs/series/timeseries_access
Funny thing that even though simetimes I got SymbolInfoDouble(DifferentSymbol,SYMBOL_LASTHIGH), the of SYMBOL_LASTLOW still has 0 value.
Risk of endless loop, no ?
Oh, most definitely. It is a lazy snippet after-all, and I'd assume that whoever uses it will know what to do with it to make it safe for work.
Thank you guys. I am researching it. Apparently, it's a history data issue.
You need to make sure the symbol is selected in the market watch. Once it is selected the terminal will update the broker server which will then send back the most recent tick for that symbol. This is why I used a while loop in my example -- so it can pickup the exact moment the tick arrives back from the broker server.