
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I can see how your CountryIdToCountry function can sometimes be useful, so I added that to the code. Thanks.
I don't have accounts with brokers in different time zones, so I can't answer your question. However, it shouldn't be necessary to use multiple MT5 installations on your machine. Just temporarily changing the account login should be sufficient.
It is only my assumption(!) that the event time is given as GMT time format. At least with this assumption I get correct results that match with time data from other event calendars, whereas server time or local time would give me wrong result.
The event times are saved in the newshistory.bin file exactly as they are downloaded, so no time format conversion happens here. Having access to the correct GMT time is necessary only later for interpretation (like e.g. in the "next()" function that also has the option to show the next event as a vertical line in the chart, which is only possible if the event time can be interpreted correctly). Therefore the function news.GMT() as an alternative the built-in TimeGMT() function can also be accessed externally from within the main EA code. This avoids the problems with using TimeGMT in the tester (cause other than in live mode it wrongly returns the server time instead).
I probably should add alternative overloads to the "next()" function: the next event "relative to a given time" (like e.g. TimeCurrent()) instead of "relative to an index number".
I did some minor changes in the News.mqh file and tested with calendar events of last week so that I could easily compare with Metaquotes' official calendar.
Here is a little convenient code for that purpose (you can use that for checking if the real event times also match if you use your broker (with my broker the time data are correct). One stupid thing is that the values (prev./forecast/actual) are supplied as long variables with a separate value for the digits, instead of simply using double variables. I haven't found out yet how to correctly convert that to doubles. You'll see what I mean if you run this code (as always: with an existing newshistory.bin file or at least once on live data):
and here the News.mqh with the minor changes:
Fantastic! I'm loving this!!
i love your next function, but i did a very minor tweak to make it able to select for two currencies and then colour code the result. I added it as another function rather than changing the existing one and named it 'next2'
I might have found a slight bug for those with NY Close broker time:
When starting the tester pre-gmt shift then letting the test run over the GMT shift date, it gives different news placement to starting the tester post GMT shift, so it seems the transition from wintertime to summertime is only working during initialisation.
looking at the GMT() function, it assumes that there are Sunday candles (tm.day_of_week==0). My broker has NY close broker time so doesn't have Sundays, so tm.day_of_week==0 needs changing to tm.day_of_week==1 or tm.day_of_week<=1 or something similar in the following when using NY close brokers:
I did some minor changes in the News.mqh file and tested with calendar events of last week so that I could easily compare with Metaquotes' official calendar.
Here is a little convenient code for that purpose (you can use that for checking if the real event times also match if you use your broker (with my broker the time data are correct). One stupid thing is that the values (prev./forecast/actual) are supplied as long variables with a separate value for the digits, instead of simply using double variables. I haven't found out yet how to correctly convert that to doubles. You'll see what I mean if you run this code (as always: with an existing newshistory.bin file or at least once on live data):
and here the News.mqh with the minor changes:
Hi,
I am getting an Out of range error when testing your code:
Hi,
I am getting an Out of range error when testing your code:
I think you have to increase the array size to 50,000 instead of 10,000 for those 3 array variable. The number news event already exist 10,000 and the array is not big enough to hold.
Hi everyone,
I have also the problem with the "out of range error"
Morevover the News Filter doenst even find some news.
Can anyone Help me with this Problem...
Thanks in advance!
Thanks for the information, Enrique!
Unfortunately, I also get an error message.
I used his example "Calendar_Example" EA in the MT5 Backtester platform and got these results:
Can you help me with this?