The EA I wrote three months ago can not pass the strategy testing now, but it used working well two or three months ago!!

 
The EA I wrote three months ago can not pass the test now, but it used working well in MetaQuotes-Demo server . Is there anybody that met the same problem? The Error code is always like "failed instant sell 0.10 EURUSD at 1.38103 sl: 1.38253 tp: 1.38053 [Invalid request]" and " OrderSend failed with error #4756 ".My version is 5.00 Build 540 . Help , i am totally confused.
-----------------------------------------------------------------------------------
if (condition1)
{
sell.action = TRADE_ACTION_DEAL;
sell.type = ORDER_TYPE_SELL;
sell.symbol = _Symbol;
sell.deviation = 0;
sell.price = NormalizeDouble(mtick.bid,_Digits);
sell.volume = 0.1;
sell.tp = NormalizeDouble(sell.price - mtp*_Point,_Digits);
sell.sl = NormalizeDouble(sell.price + msl*_Point,_Digits);
sell.type_filling = ORDER_FILLING_AON;
if(OrderSend(sell,result_sell)==false)
{
Print("OrderSend failed with error #",GetLastError());
ResetLastError();
}
}
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 

Try add ZeroMemory(sell).

if (condition1)
{
ZeroMemory(sell);
sell.action = TRADE_ACTION_DEAL;
sell.type = ORDER_TYPE_SELL;
sell.symbol = _Symbol; 
We have fixed this issue, wait for next build, please.
 
Rosh:

Try add ZeroMemory(sell).

We have fixed this issue, wait for next build, please.

Rosh, just updated to .565 and did get same message  #4756

ZeroMemory(struct) helps. So it's fixed or not yet?

 

Thanks 

 
Rosh:

Try add ZeroMemory(sell).

We have fixed this issue, wait for next build, please.

I have the same error although I've followed the exact way to compose the order.  How come?  I am using build 597. 

 

2012.02.26 20:08:18 Core 1 2012.02.23 08:00:00   Alert: The Buy order request could not be completed -error:4756

2012.02.26 20:08:18 Core 1 2012.02.23 08:00:00   failed market buy 0.10 EURUSD sl: 1.32438 tp: 1.33738 [Unsupported filling mode]

 

      if(Buy_Condition_3 && Buy_Condition_4)

        {

         // any opened Buy position?

         if(Buy_opened)

           {

            Alert("We already have a Buy Position!!!");

            return;    // Don't open a new Buy Position

           }

         ZeroMemory(mrequest);

         mrequest.action = TRADE_ACTION_DEAL;                                  // immediate order execution

         mrequest.type = ORDER_TYPE_BUY;                                        // Buy Order

         mrequest.symbol = _Symbol;                                            // currency pair

         mrequest.deviation=0;                                                // Deviation from current price

         mrequest.price = NormalizeDouble(latest_price.ask,_Digits);           // latest ask price

         mrequest.volume = Lot;                                                 // number of lots to trade

         mrequest.tp = NormalizeDouble(latest_price.ask + TKP*_Point,_Digits); // Take Profit

         mrequest.sl = NormalizeDouble(latest_price.ask - STP*_Point,_Digits); // Stop Loss

         mrequest.type_filling = ORDER_FILLING_AON;                             // Order execution type         

         //--- send order

         OrderSend(mrequest,mresult);

         // get the result code

         if(mresult.retcode==10009 || mresult.retcode==10008) //Request is completed or order placed

           {

            Alert("A Buy order has been successfully placed with Ticket#:",mresult.order,"!!");

           }

         else

           {

            Alert("The Buy order request could not be completed -error:",GetLastError());

            ResetLastError();           

            return;

           }

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 

I notice in the MQL5 reference (latest version that just updated today), there is no ORDER_FILLING_AON anymore, but even I use ORDER_FILLING_FOK, I still encounter error 4756.  Please advise.

ENUM_ORDER_TYPE_FILLING

Identifier

Description

ORDER_FILLING_FOK

The deal can be executed exclusively with a specified volume at the equal or better price than the order specified price. If there is no sufficient volume of offers on the order symbol, the order will not be executed. This type of filling is used in SYMBOL_TRADE_EXECUTION_INSTANT or SYMBOL_TRADE_EXECUTION_REQUEST execution modes.

ORDER_FILLING_IOC

An agreement to execute the deal with maximal market volume at the equal or better price than the order specified price. In this case an additional order for volume unfilled will not be placed. This type of filling is used in SYMBOL_TRADE_EXECUTION_MARKET and SYMBOL_TRADE_EXECUTION_EXCHANGE execution modes depending on the symbol settings on a trade server.

ORDER_FILLING_RETURN

An agreement to execute the deal with maximal market volume at the equal or better price than the order specified price. In this case an additional order for volume unfilled will be placed. This type of filling is used only for pending orders (TRADE_ACTION_PENDING).

 
Hi, any comment before I give up MT5 and go back to MT4?  Many thanks!  I am actually new to both but would give MT5 a try first although I know it is very new.
 
lingwuchung:
Hi, any comment before I give up MT5 and go back to MT4?  Many thanks!  I am actually new to both but would give MT5 a try first although I know it is very new.

Add this before the mrequest:

 ZeroMemory(mrequest);
   ZeroMemory(mresult); 

 I've had the exact same problem as you did and it fixed it for me.

 

I have the same problem now.

My expert advisors were working very well. But now all of them can't pass the tester.

When I compile the file's, the following messege will shown:

 

'ORDER_FILLING_AON' - undeclared identifier

 

How can this problem be solved??

 

IIs this the result of a terminal update? (Version 5.00 Build 642)

(24 april 2012)

 

Hope that somebody can help me 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 
lamme.vandriel:

When I compile the file's, the following messege will shown:

'ORDER_FILLING_AON' - undeclared identifier

How can this problem be solved??

Replace ORDER_FILLING_AON to ORDER_FILLING_FOK (see Order properties)

 
JohnnyDoe:

Add this before the mrequest:

 I've had the exact same problem as you did and it fixed it for me.

Hello, I've added these 2 lines in the code but error 4756 still here (Trade request sending fail).

Could you please precise where excatly I should add the 2 lines ? The one concerning mrequest is already present. Adding both of them doesn't change anything for me. Thank you for the help I'd appreciate.

I'm running rel.5 build 842.

 ZeroMemory(mrequest);
   ZeroMemory(mresult); 
 
Vivaldi:

Hello, I've added these 2 lines in the code but error 4756 still here (Trade request sending fail).

Could you please precise where excatly I should add the 2 lines ? The one concerning mrequest is already present. Adding both of them doesn't change anything for me. Thank you for the help I'd appreciate.

I'm running rel.5 build 842.

Show your code, so we can say you where to add this line.