Too many entries

 

Can someone please help me figure out why my ea is placing multiple orders? It's supposed to place an order every time the histogram crosses the zero line but it's placing trades after the first one is closed.


Thanks for your help...


R

Files:
ra_yuri.mq4  11 kb
 
ra457:

Can someone please help me figure out why my ea is placing multiple orders? It's supposed to place an order every time the histogram crosses the zero line but it's placing trades after the first one is closed.


Thanks for your help...


R

have you coded it to place a trade if the indy crosses 0 ....or if the last candle was below 0 and current candle is above 0...

for example : double lastcandle = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,2)

double newcandle = double lastcandle = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1)


now use it to limit orders to only a 0 cross...like this :


//For a buy

if(lascandle<0&&newcandle>0)

{

Ordersend(....)

}


//for a sell

if(lascandle>0&&newcandle<0)

{

Ordersend(....)

}

Reason: