Trying to code my EA to only trade in the 3 hours between 8 am and 11 am EST time. Can someone show me some light or point me to an article please? thank you.
- When MetaTrader 5 Web Terminal is indispensable
- MetaTrader 5 for your employees
- MetaTrader 5 for Forex, stocks and futures
clemonsla:
Trying to code my EA to only trade in the 3 hours between 8 am and 11 am EST time. Can someone show me some light or point me to an article please? thank you.
Trying to code my EA to only trade in the 3 hours between 8 am and 11 am EST time. Can someone show me some light or point me to an article please? thank you.
See here ;-)
Or may be this.
Amazon Best Sellers: Best Electrical Timers
- reviews: 45
- www.amazon.com
Discover the best Electrical Timers in Best Sellers. Find the top 100 most popular items in Amazon Home Improvement Best Sellers.
You may use "TimeGMT" function to get the current GMT time. Then convert it to US EST time (NY time) and compare it with the time that you want to trade. In the meantime, you may need to consider the daylight savings.
For example:
bool IsGoodTimeToTrade() { int tStart = 8, tEnd = 11; int offset = -5; // EST timezone if(TimeDaylightSavings()!=0) // need to consider daylight savings? offset++; MqlDateTime gmtTime; TimeGMT(gmtTime); if(gmtTime.hour>=tStart-offset && gmtTime.hour<tEnd-offset) return true; else return false; }
Please note the above code doesn't work with all settings (the "tStart-offset" or "tEnd-offset" may greater than 24 or less than 0, if we choose different start/end/offset values). It's just an example.
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