Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
Corrected
That's fine, thank you. I guess this way i can avoid those requote errors. But what if i want to update prices in order to prevent requotes?
Even if i'm handling those errors i have no way to refresh all pairs prices, and i'm probably going to enter late in the trade because of the repetition of this error
double bid = SymbolInfoDouble(symbol, SYMBOL_BID), ask = SymbolInfoDouble(symbol, SYMBOL_ASK);
What part of "you must handle" and the links provided was unclear?
- Those will be zero for symbols not in Market Watch or on an open chart.
- Since OP is trading the symbol, he'll need history as well.
The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't return zero the first call.
William,
the unclear part is: it is almost useless to handle an error if i don't even try to get the new data. First, let's try to refresh price data, then i will handle error if prices were not updated.
If i need data from a website, then
a=getWebsiteData (url)
read a, use it
handle error or exceptions if needed
This works. The following doesn't work
read a, use it
handle error or exceptions if needed
a has not been updated, so the rest is useless
Well,
actually i didn't need to download history, so it looked like some kind of solution but NOT the right solution. In that sense, it was really unclear.
Anyway, if there's no other ways, it's fine.
Secondly, i think you will avoid people arguing about your answers if you just add one plus line to your comments, the link looked quite off topic.
It's not mandatory, it's just if you want people to be more happy about your answers and try to get more popularity / authority / whatever.
What part of "you must handle" and the links provided was unclear?
The user's question is clear.
Why does SymbolInfoDouble () - MarketInfo () not work for other pairs, except for the pair selected in the expert?
And you, in praise of idiocy, have filled all the forums with a copy and paste of information that does not help.
The error is not from Historics (although it could be) the error is that SymbolInfoDouble () - MarketInfo () do not work.
If you are going to help, give your opinion. If you want (and you know some programming) create an expert that shows the ASK prices of all available pairs.
Hely Rojas: Why does SymbolInfoDouble () - MarketInfo () not work for other pairs, except for the pair selected in the expert?
It does, if you update before accessing values.
- Marco Strazzeri: actually i didn't need to download history, so it looked like some kind of solution but NOT the right solution.So replace the function provided with the equivalent:
ResetLastError(); double bid = SymbolInfoDouble(symbol, SYMBOL_BID); if(_LastError != 0){ if(_LastError != ERR_HISTORY_WILL_UPDATED && _LastError != ERR_NO_HISTORY_DATA Print(StringFormat("iTime(%s,%i) Failed: %i", symbol, period,_LastError)); return; }
When in doubt, think!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have an Expert Advisor which is operating on multiple pairs.
The problem is that when i close positions, from time to time i get repeated 136 errors ( off quotes ).
I'm getting Bid Ask through MarketInfo; since RefreshRates() is totally uneffective, how to update the prices for a specific symbol?
Thank you