Qstn on EA fundamentals TIA for your reply/answers.

 

Is there any FAQ for EA/Strategy tester?

Please provide the link if any.

I am trying to write/test an EA where the logic will be tested at close of each 4 hour bar.

Is there any facility like this on EA?

Does EA checks for each tick only?

Or it can be modified to check some parameters only after a close of 4 hour bar. For example I am trying to buy/sell based on a EMA cross of 5/21 but I want to do that only at the closing of a 4 hour bar and not for the every tick as being done in EA/Indicator.

Thanks in advance for your time/replies.

Kent

 

In order to trade on the beginning of an open bar only, add the following code:

static datetime timeprev; // at top of program

if(timeprev==Time[0]) { //at beginnign of start()

return(0); //only execute on new bar

} else if (timeprev==0) {

timeprev=Time[0]; //prevents execution when loading EA onto chart

} else {

timeprev=Time[0];

H4Processing();

SendMail();

}

 

One more thing. A moving average cross will not work by itself. Even on an h4 graph.

Reason: