Help with EA instant order requote problem!!

 

I have a problem with an EA I am working on.. it is supposed to make 2 instant orders but sometimes, I will get requoted and one of the instant orders will not go through.. is there some coding that will make sure both orders will be executed?

 

bump.. help still needed

 

Slippage may be ...

I am not sure.

Try to set this slippage value.

 

Yes! set slippage to 5.

And try this code to auto try opening the order:

int NumberOfTries = 5;

........

if(BuyCondition) //<-- BUY condition

{

ticket = OpenOrder(OP_BUY); //<-- Open BUY order

......

}

int OpenOrder(int type)

{

int ticket=0;

int err=0;

int c = 0;

if(type==OP_BUY)

{

for(c = 0 ; c < NumberOfTries ; c++)

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,ExpertComment,MagicNumber,0,Green);

err=GetLastError();

if(err==0)

{

break;

}

else

{

if(err==4 || err==137 ||err==146 || err==136) //Busy errors

{

Sleep(5000);

continue;

}

else //normal error

{

break;

}

}

}

}

if(type==OP_SELL)

{

for(c = 0 ; c < NumberOfTries ; c++)

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,ExpertComment,MagicNumber,0,Red);

err=GetLastError();

if(err==0)

{

break;

}

else

{

if(err==4 || err==137 ||err==146 || err==136) //Busy errors

{

Sleep(5000);

continue;

}

else //normal error

{

break;

}

}

}

}

return(ticket);

}
 

MT4 requote problem

I have been using Interbankfx Demo for a while now. My EA is doing ok but I keep getting requoted. How do I fix this? Is there a way I can tell my EA to take the requote?

 
caldolegare:
I have been using Interbankfx Demo for a while now. My EA is doing ok but I keep getting requoted. How do I fix this? Is there a way I can tell my EA to take the requote?

Try to use slippage value not less than 5 in your OrderSend functions.

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)

 

ok i will give that a try. i have it set at 3 right now.

 

even i set the slippage to greater than 5 but

still get the error : requote anyway

could someone help solving that problem

 

EA and requote question

Hi everyone.

I'm forward testing my first EA that made the cut beyond backtesting, and I just ran into an issue.

It was supposed to open a trade on EUR/USD a few minutes ago, and it didn't. It opens trades fine usually (three earlier and one while I was typing this), but this time when I check my journal it says:

2007.03.19 22:47:11 '1406113': requote 1.3277 / 1.3279 for open buy 0.04 EURUSD at 1.3281 sl: 0.0000 tp: 0.0000

2007.03.19 22:47:10 '1406113': request was accepted by server

2007.03.19 22:47:00 '1406113': instant order buy 0.04 EURUSD at 1.3281 sl: 0.0000 tp: 0.0000

...and there is no trade.

I have slippage set to 3. Shouldn't it have placed the order despite the requote, or am I missing something? How do I ensure that the orders are filled in the future?

Many thanks in advance!!

Seavo

 

I think that is a good question for your broker. You are within 3 pips. However, I think that slippage is mostly applicable when you enter trades with a stop order. I think you will have to program in a requote handling routine in your EA if you want to use market orders. Will be interested in what you find out.

Good luck.

 

Thanks Maji

You're right. A requote handling routine is exactly what I need. Now I guess I'll have to find out how to do that

Thanks for your help, and BTW, for the help from many other posts of yours I've read along the way too!

Seavo

Reason: