Download MetaTrader 5
To add comments, please log in or register
Are you a good trader? Become a signals provider and make even more money!
rtf72
11
rtf72 2016.08.23 14:15 

How can I fetch a newly released economic calendar value and set it as an 'extern int'? Is it possible in MQL4? For example, if I needed the latest value of the UK Bank of England Interest Rate, could I fetch the latest figure the second (or near the time) it was released? 

whroeder1
13596
whroeder1 2016.08.23 16:43  
rtf72: How can I fetch a newly released economic calendar value and set it as an 'extern int'? could I fetch the latest figure the second (or near the time) it was released?
  1. You can't. If you just store it in the extern variable, it will be lost on a restart.
    EA's must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV+flush or files) of ticket numbers required.
    Store the value in a GV
  2. You're not going to be able to poll a web server even at a 10 second interval. Forget trying to trade news.
    /
    To add comments, please log in or register