int DOW = TimeDayOfWeek(now), /* https://forum.mql4.com/33851 // reports DayOfWeek() always returns 5 in the tester. No refresh?*/ DayMask = 1 << DOW; // #define DAYS_MAX 0x3F // 1<<6-1=63. (S-F) //extern int Days.Mask = 55; // Not Wed if (Days.Mask & DayMask == 0){ EA.status="Day="+DOW; return(0); } //extern double TradeHr.UTC.Start = 7.3; // London-1 //extern double TradeHr.UTC.End = 12.9; // NY open int secStart = 3600*TradeHr.UTC.Start, secEnd = 3600*TradeHr.UTC.End, hrBeg = (now-secStart+86400)%86400, hrEnd = (now-secEnd +86400)%86400; if (hrBeg > hrEnd){ EA.status="HR"+DoubleToStr(hrBeg/3600.-24,2); return(0); }
thank you very much. very useful.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
hello,
i am new to MT4 programming and i want to write my strategy to build a simple EA.
i managed to write the enter parameters using a free tool i found on the internet, but i can't introduce time filters, which are very important for me.
can you please help me to introduce this instructions:
1) Watch the close of the 7.15 bar
2) enter at 7.30 if "buy conditions" are true
3) Exit anyway all trades at 9.30
to be simple i want that at 7.30 my EA enters a trade only if the conditions that i wrote are met at the end of the previous 15M bar.
thank you very much if someone could help me.