View Single Post
  #32 (permalink)  
Old 08-02-2005, 08:06 PM
ondigio ondigio is offline
Freshman
 
Join Date: Jun 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ondigio is on a distinguished road
Default

That's good news--that's when I'm getting the messages as well. One less bug to worry about! I was getting a few extraneous UPDATE_TRADES events when no trade activity had occurred, which is what made me think I might be missing a bunch more, but I believe those were due to the pumping connection timing out and reconnecting (I also get UPDATE_TRADES right after initializing pumping, which makes sense.) My cable connection at home is a little unreliable...luckily my server is much better connected!

According to Slawa (or one of those other less-than-helpful guys at MetaQuotes), you're supposed to wait 5 seconds between calls to MtGetTrades, right? If you call it every time new prices arrive you're definitely exceeding that limit. There's also (supposedly) a 2-minute connection time limit for non-pumping sockets, so I assume you're opening a new connection for each GetTrades/GetTradeRecords call? Have you had any problems opening so many connections? Isn't the connection operation a little too expensive to be run so often?

My plan was to get the updates only once every minute or so. For my purposes, the account/trades data doesn't really need to be updated on every tick--it's mostly just for the user to look at.

Interesting to hear about the message loop problems. For now, that shouldn't affect me as that part runs only on the Windows side.

How do you determine if the ticks are flowing? Do you just timeout if there've been no ticks for some number of seconds? I've considered doing that myself. The connection from my server has (so far) been very stable, but it does get dropped perhaps once every few days. Currently, the way I detect it is with the END_PUMPING event--I'm not sure what causes the connection to die, but after about 2 minutes of no ticks coming in, I get an END_PUMPING message, then I reconnect and restart pumping. This method hasn't failed me yet, but I do lose 2 minutes of tick data every time it happens...would be nice to shorten that to a few seconds.

One more thing (sorry!) -- as far as I can tell, the only way to get the final data on a closed trade is to call GetTradeHistory. Right? It doesn't get pumped in--it just disappears from the open trades list without informing us of its close time or price. How do you handle this? I figure I can either a) grab the data for each trade after it disappears from the list, or b) do a "sweep" of the history at regular intervals, starting from the earliest opening time of all trades whose closing data I don't yet have. I'm leaning toward the second option.
Reply With Quote

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now

Main Menu

Economic Forecast