Noob Code Question >Wrap EA Logic<

 

I am trying to add a Time Filter to allow trading only during select times. I was refered to a site (http://www.cubesteak.net/2006/08/3-fold-trading-hours-filter-for-ea/) that has what I want to implement, but don't know how to do it.

It says:

"Simply wrap all your EA logic in the call to HourlyFilter()"

and

"Pseudo code for placement in the Start() function is:

if HourlyFilter()
{
PerformEALogic();
}
else return (0);"

I do not know how to go about "wrapping the EA logic".

Can anyone offer suggestions?

Thanks!

 

Scotty

Keep it simple :)

Use the Time functions, eg


int h=TimeHour(TimeCurrent());

if (h < 6) return(0); // i.e. quit if too early


NB - the Time functions reflect the brokers server timezone - may not be yours

Good Luck

-BB-

 
BB, THANK YOU! Even I can understand this simple code and it works like a charm. Exactly what the doctor ordered!
Reason: