Hi,
I'm trying to place order using the code given below. Please tell whats wrong with it. I thought there is a problem with Ask, so I used NormalizeDouble(Ask,4)
Hi,
the answer is in this post.

They have discussed about the ERROR #4752. But now I'm getting ERROR #4756
2013.07.01 20:12:41 test (EURUSD,H1) OrderSend failed with error #4756 2013.07.01 20:12:41 test (EURUSD,H1) Entry = 1.3029, TP = 1.3129, SL =0.0
Please help.
They have discussed about the ERROR #4752. But now I'm getting ERROR #4756
Please help.
MqlTick last_tick; SymbolInfoTick(_Symbol,last_tick); double Ask = last_tick.ask; double Bid = last_tick.bid; MqlTradeRequest request; MqlTradeResult result; int Total_Trades = 1; double TakeProfit = 0.01; i++; request.action = TRADE_ACTION_DEAL; request.magic = 1; request.order = i; request.price = NormalizeDouble(Ask,4); //request.sl = 0;//NormalizeDouble(Ask-0.02,4); //request.tp = 0;//NormalizeDouble(Ask+TakeProfit,4); request.deviation = 3; request.type = ORDER_TYPE_BUY; request.type_filling = ORDER_FILLING_RETURN; request.comment = "First_Order"; Print("Entry = ",request.price, ", TP = ", request.tp, ", SL =",request.sl); if(OrderSend(request, result)) Print("OrderSent");
After reading some articles I removed the SL and TP. But still I am getting same error #4756.
- You don't have to set request.order for a BUY. Not sure if it's your problem.
- Can you print the result.retcode when you have an error :
{ Print("OrderSend failed with error #",GetLastError(), " Retcode = ", result.retcode); //return(0); }
- If you can provide code that compiles, it would be more easy to help you.

- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
- You don't have to set request.order for a BUY. Not sure if it's your problem.
- Can you print the result.retcode when you have an error :
- If you can provide code that compiles, it would be more easy to help you.
2013.07.02 15:30:38 test (EURUSD,H1) Entry = 1.3028, TP = 1.3128, SL =1.2828, Volume = 1.0
I checked volume too.
ulong i =1; int OnInit() { return(INIT_SUCCEEDED); } void OnDeinit(const int reason){} void OnTick() { if(i==1) { MqlTick last_tick; SymbolInfoTick(_Symbol,last_tick); double Ask = last_tick.ask; double Bid = last_tick.bid; MqlTradeRequest request; MqlTradeResult result; int Total_Trades = 1; double TakeProfit = 0.01; i++; request.symbol = _Symbol; request.action = TRADE_ACTION_DEAL; request.magic = 1; request.order = i; request.price = NormalizeDouble(Ask,4); request.sl = NormalizeDouble(Ask-0.02,4); request.tp = NormalizeDouble(Ask+TakeProfit,4); request.volume = 1; request.deviation = 3; request.type = ORDER_TYPE_BUY; request.type_filling = ORDER_FILLING_RETURN; request.comment = "First_Order"; Print("Symbol = ",_Symbol," Entry = ",request.price, ", TP = ", request.tp, ", SL =",request.sl,", Volume = ",request.volume); if(OrderSend(request, result)) Print("OrderSent"); if(result.retcode==10009 || result.retcode==10008) { i++; Print("This is First Buy Order"); } else { Print("OrderSend failed with error #",GetLastError(), " Retcode = ", result.retcode); } } }Please check the code.
Please check the code.
You have to modify this line :
MqlTradeRequest request;
to
MqlTradeRequest request = {0};
You have to modify this line :
to
Same error after modifying MqlTradeRequest.

- www.mql5.com
Same error after modifying MqlTradeRequest.

- www.mql5.com
Hi,
I'm trying to place order using the code given below. Please tell whats wrong with it. I thought there is a problem with Ask, so I used NormalizeDouble(Ask,4)
2013.07.01 19:47:43 test (EURUSD,H1) OrderSend failed with error #4752
2013.07.01 19:47:43 test (EURUSD,H1) Entry = 1.3032, TP = 1.3132, SL =0.0