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
string separator1 = "------ GMT Trading Days ------";
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
-
Search for it,
-
Beg at
- Coding help -
MQL4 and MetaTrader 4 - MQL4 programming forum
-
Requests & Ideas (MQL5 only!) -
Trade FX - Expert Advisors and Automated Trading -
MQL5 programming forum
-
Free coding for your
trading system.. - Easy Trading Strategy - General -
MQL5 programming forum
-
I will code & automate your
strategy for free - Options Trading Strategies - General -
MQL5 programming forum
-
Make It No Repaint Please! -
MetaTrader 5 - MQL4 and MetaTrader 4 -
MQL4 programming forum
-
learn
to code it. If you don't learn MQL4/5, there is no common language
for us to communicate. If we tell you what you need, you can't code it. If we
give you the code, you don't know how to integrate it into yours.
-
or pay (Freelance)
someone to code it.
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.No free help
urgent help.
First, I'd follow William Roeder's requests (remove duplicate post, etc.) Then I'd simply use his morninghours/afternoonhours code from 2011 found on the previous page. Of course it needs a little tweaking to make it work in MQL5. Something like changing the Hour() functions to TimeHourMQL4() found here.
This is currently working as expected. If is outside this time range the EA does not trade.
if((Hour()<=StartTime || Hour()>EndTime))return(0); //Preferd Trading Hours
From an older EA, which I believed tested successfully but is not working.
if((Hour()<=7 || Hour()>=10) || (Hour()<=14 || Hour()>=18))return(0); //Prefer Trading Hours
Any Ideas why the second option is not working?
I am assuming I can configure & test the following, but was looking for a cleaner solution.
if(Hour()==7 || Hour()==8 || Hour()==9 || Hour()==10 || Hour()==14 || Hour()==15 || Hour()==16 || Hour()==17 || Hour()==18)return(0); //Prefer Trading Hours
Thank you.
I'm decades late to this chain but I wondered the same thing and saw @Simon Gniadkowski's function which works for a single time frame. With a little tweak it works for the 2 time frames letting the user specify. Just tested it with the EA I'm building.