EA should operate after Zero bar closes. Not on each tick.

 

Hello again,

MetaTrader operates on the Tick. My EA should start analysing Trade signals when the Zero bar closes and becomes bar 1.

So it analyses only 1 time and not on each tick.

I'm wondering if there is a command that controls this situation.

Anybody has an idea ?

Thanks

 

Hi,

I'm not a programer so I hope I'm not misleading you.

What I would do is:

int MyBars=0;

.......

//**** Open (or close) position conditions *****

if (("your conditions"........) && MyBars<Bars )

{

ordersend (...........)

MyBars=Bars;

return(0);

}

** hope this helps you.....

regards.

 

try this:

static int EA_CURRENT_BAR = 0; //put it before init() function

Start()

{

if( EA_CURRENT_BAR == 0 || EA_CURRENT_BAR < Bars )
{
EA_CURRENT_BAR = Bars;

.............

your code in here

.............
return (0);
}

return(0);

}

 
Volume is unreliable, you can skip ticks. Bars in unreliable (once you reach max bars in chart it won't change.) Always use time:
start(){
   static datetime Time0; if (Time0 == Time[0]) return; Time0=Time[0];
   ...
 
WHRoeder:
Volume is unreliable, you can skip ticks. Bars in unreliable (once you reach max bars in chart it won't change.) Always use time:

Exactly.

There are a whole bunch of things that look fine in theory, but doesn't work as expected in practice.

Fortunately, Print() is your best friend in the MQL world.

 
blogzr3:

Exactly.

There are a whole bunch of things that look fine in theory, but doesn't work as expected in practice.

Fortunately, Print() is your best friend in the MQL world.



Thanks gentlemen, for your support and help.

Have a nice week.

 
WHRoeder:
Volume is unreliable, you can skip ticks. Bars in unreliable (once you reach max bars in chart it won't change.) Always use time:
I retract my comment, and in fact, I'm off to change my EA right now. :)
Reason: