3 Fold Trading Hours Filter for EA
August 25, 2006 9:46 pmIn a previous post, I made available a small indicator that simply mentioned if you should be trading or not based on three different configurable timeframes.
In the process of changing the logic for use in an EA, I also improved on the previous indicator. You can now use hours and minutes, not just hours for the configured time frames.
The file below is not a new indicator, but is intended to be included in an EA. Its is the 3 Fold Trading Hours logic turned into a boolean function. Simply wrap all your EA logic in the call to HourlyFilter(); It returns true when the time is within your specified hours, and false when it’s not.
Pseudo code for placement in the Start() function is:
if HourlyFilter()
{
PerformEALogic();
}
else return (0);
UPDATE: There was an error in the source, which has now been fixed. Filter 3 was being checked twice, and Filter 2 was being ignored. Sorry for any inconvenience.
3FoldTradingFilterforEA.mq4
3FoldTradingFilterforEA.zip
Categories: MT4 Includes
2 Comments »


2 Responses to “3 Fold Trading Hours Filter for EA”
[...] Original: Visual reminder via a chart comment New: Visual reminder via a new indicator window (available below) Also: Time filter for an Expert Adviser to actually stop trading from happening [...]
[...] help coding a Time Filter that will only allow trades between time ‘x’ and time ‘y’. I found one at Cubesteak Central » Blog Archive » 3 Fold Trading Hours Filter for EA that I really like, but am having trouble integrating it with what I’m doing. In reading the page [...]
Care to comment?