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
Hi everyone
I would like some feedback on my code or how I can make it more efficient as it uses several conditionals and loops.
I wanted to create a multicurrency news filter for when 30 minutes before and after the current time there is an important news event.
For each news event I need its Time, Importance Level, Currency
I read the Mql5 Calendar Documentation and I found that to get each one of those I need to use three different structs
Time in MqlCalendarValue
Importance in MqlCalendarEvent
Currency in MqlCalendarCountry
Hence my way of thinking is the following
Make a function that creates a string of all the base currencies that have important events coming up.
1) Use CalendarValueHistory() to store in MqlCalendarValue array all event IDs within the needed times.
2) Loop thought the above above array and use CalendarEventById() on the IDs collected from(1),to gather important enough events and country ID.
3) Use CalendarCountryById() on the countryIDs collected from (2) in order to gather the currency.
4) Store all the Currencies in a string
The above function is to run every x minutes to gather new events.
5) Check if a symbol's base/profit/margin currency exists in the string created in 4 to determine if it has news affecting it