One of the examples:
OrderModify with same TP and SL as before and repeat it then it gives error#0.
Solution here:
if (sl != OrderStopLoss() || tp!= OrderTakeProfit()) { // OrderModify here }
Regards,
Anton
One of the examples:
OrderModify with same TP and SL as before and repeat it then it gives error#0.
Solution here:
Regards,
Anton
Grazie amico mio
SAME ERROR 0:
PLease helP ME
if (Stoploss!=0 && Ask>=OOP + Stoploss * Point) {if (OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),slippage,clrNONE)) continue;}
if (Takeprofit!=0 && Ask<=OOP - Takeprofit * Point) {if (OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),slippage,clrNONE)) continue;}
if (OSL==0 && Stoploss>=STOPLEVEL && Stoploss!=0)
{
SL = NormalizeDouble(OOP + Stoploss * Point,Digits);
}
if (OTP==0 && Takeprofit>=STOPLEVEL && Takeprofit!=0)
{
TP = NormalizeDouble(OOP - Takeprofit * Point,Digits);
}
if (TrailingStop>=STOPLEVEL && TrailingStop!=0 && (OOP - Ask)/Point>=TrailingStart)
{
StLo = NormalizeDouble(Ask + TrailingStop*Point,Digits);
if (StLo <= OOP && (StLo < OSL-TrailingStep*Point || OSL==0)) SL = StLo;
}
if (SL != OSL || TP != OTP)
{
if (!OrderModify(OrderTicket(),OOP,SL,TP,0,clrNONE)) Print("Error OrderModify <<",Error(GetLastError()),">> ");
Hi Dears, I've just installed my new ea on live account and I'm getting Error 0 every time that an order is triggered. I want ask you if is it possible that the latency of execution is my "error0".. because the same ea always worked in other versions and different mt4. I put the code that place order, so you can see that i refresh rates, now refresh also just before sending order (i've to see if this can fix issues). please let me know what do you think about it. thanks
bool PlaceOrder(int type, int magic, int id, bool checkmargin = true) { //Print("PlaceOrder called.. Type : "+TypeToStr(type)); double entry, lot; color col; int typet; int i = 0; while(i < NumRetries) { i += 1; while(IsTradeContextBusy()) Sleep(RetryDelayInSec*1000); RefreshRates(); if(type == OP_BUY) { entry = Ask; col = Blue; typet = 2; } else { entry = Bid; col = Red; typet = 4; } if(MathAbs(entry-Close[1]) > stoplevel) break; //--Controllo che non ci siano stati spike nel prezzo (es. new impattante) if(LotCalculation == FixedLots) lot = FixedLotSize; else lot = GetLotSize(type, entry); Print("Try "+i+" : Open "+TypeToStr(type)+" order. Entry : "+DoubleToStr(entry,Digits)+" Lot :"+lot+" Magic :"+magic); if(checkmargin) { double margin_required = 2 * MarketInfo(Symbol(),MODE_MARGINREQUIRED)*lot; double initloss = MathCeil((InitialPL() + CommissionPerLot)*lot); //Print("margin_required to open 2 trades : "+margin_required+" initloss : "+initloss+" AccountFreeMargin : "+AccountFreeMargin()); if(AccountFreeMargin() <= margin_required+initloss) { Print("Unable to place order due to insufficient margin"); return(false); } } /*-- STOP ORDERS if(typet==2) int ticket = OrderSend(Symbol(),typet,lot,Close[1],Slippage,Close[1] - (MyRPips *myPoint) ,Close[1] + (MyRPips * myPoint * TradeRewardMult),TradeComment,magic,120,col); if(typet==4) ticket = OrderSend(Symbol(),typet,lot,Close[1],Slippage,Close[1] + (MyRPips *myPoint) ,Close[1] - (MyRPips * myPoint * TradeRewardMult),TradeComment,magic,120,col); */ //MARKET ORDERS if(type == OP_BUY && MaxOpenTrade <= CountOrdersByMagic(MagicNumber) ) { RefreshRates(); int ticket = OrderSend(Symbol(),type,lot,Ask,Slippage,0,0,TradeComment,magic,0,col); } if(type==OP_SELL && MaxOpenTrade <= CountOrdersByMagic(MagicNumber) ) { RefreshRates(); ticket = OrderSend(Symbol(),type,lot,Bid,Slippage,0,0,TradeComment,magic,0,col); } if(ticket <= 0) { Print("ERROR opening market order. ErrorCode:"+GetLastError()); if(i == NumRetries) { Print("*** Final retry to OPEN ORDER failed ***"); return(false); } } else { SetSLandTP(ticket, id); i = NumRetries; return(true); } } return(false); }
0 11:37:17.954 Nasdaq Ghost Robot Platinum US30Cash,M5 inputs: NGRP=Settings; LotSize=0.01; TakeProfit=150.0; Stoploss=50.0; PercentToRisk=0.02; Layer_Multiplier=8
I am getting this error while running my bot for US30 and US100, however it works fine for all the FX pairs and gold. Can anyone please help me to fix this ??

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello friends,
I'm wondering about an error in MT4.
I test one of my personal EAs and in the journal I see an alert: Error 0
Why error 0? This should mean no error, but orders remain unable to open using this robot !!!
Any share anyone?
Error 0 probably means the GetLastError() wasn't captured properly. <<< If this correct, how to allow the function GetLastError() to capture errors and let the EA works?
Regards :)
Mohammad Soubra