New Order Delay

To add comments, please log in or register
demag
37
demag  

I think I read this somewhere but can't find it now.

I've set the EA up and it works ok.

Now I want to refine it!

The first thing I want to do is to stop the EA taking a trade immediately the MA's cross because (as we all know to our cost!) the price often retraces.

What I would like to do is delay the taking of a new trade by one bar after the MA's cross.

Thanks,

demag

sunwest
192
sunwest  

Hello,

I am not sure, it is what you are looking for but you could add something like this:

int BarInProgress;

----------------------

if (Volume[0]>1) BarInProgress=1; else BarInProgress=0;

Then when you calculate your MA cross add the value BarInProgress.

When Volume[0]=1 it means that it is the open price of the new bar, so it will calculate from the last bar if Volume[0]>1

To look at 1 bar away you could put:

if (Volume[0]>1) BarInProgress=2; else BarInProgress=1;

Hope this help.

Bernard

demag
37
demag  

Thanks Bernard,

I'll give that a go and report back.

To add comments, please log in or register