update prices for a specific symbol

To add comments, please log in or register
Marco Strazzeri
60
Marco Strazzeri  

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

William Roeder
18687
William Roeder  
On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
          Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
          Corrected
Marco Strazzeri
60
Marco Strazzeri  

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

Konstantin Nikitin
11936
Konstantin Nikitin  

Price Data Structure

or
double bid = SymbolInfoDouble(symbol, SYMBOL_BID),
       ask = SymbolInfoDouble(symbol, SYMBOL_ASK);
William Roeder
18687
William Roeder  
Marco Strazzeri: But what if i want to update prices in order to prevent requotes?

What part of "you must handle" and the links provided was unclear?

William Roeder
18687
William Roeder  
Konstantin Nikitin:
  1. Those will be zero for symbols not in Market Watch or on an open chart.
  2. 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.

Marco Strazzeri
60
Marco Strazzeri  

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

William Roeder
18687
William Roeder  
Marco Strazzeri: almost useless to handle an error if i don't even try to get the new data.
  1. What part of "you must handle 4066/4073 errors before accessing prices" was unclear?
  2. What part of calling the function linked to, starts the download, is unclear?
  3. You asked how. I told you how, twice (#1 and #5.) Why are you ignoring your answers?
Marco Strazzeri
60
Marco Strazzeri  

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.

To add comments, please log in or register