what error ?
There is a trade modification error from the trailing stop loss function
What is the error and where is it in the code?
It is an order modify error from the trailing stop loss
//+------------------------------------------------------------------+ //| Trailing Stop Function breakout trade | //+------------------------------------------------------------------+ void RegularTrail() { for(int i=OrdersTotal()-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderMagicNumber()==magic) if(OrderType()==OP_BUY && enableBuyTrail()==true) { if(Bid-OrderOpenPrice()>WhenToTrail*pips) if(OrderStopLoss()<Bid-TrailAmount*pips) if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(TrailAmount*pips),OrderTakeProfit(),0,CLR_NONE)) { int err=GetLastError(); Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)); }//ordermodify }//buy order else if(OrderType()==OP_SELL && enableSellTrail()==true) { if(OrderOpenPrice()-Ask>WhenToTrail*pips) if(OrderStopLoss()>Ask+TrailAmount*pips || OrderStopLoss()==0) if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(TrailAmount*pips),OrderTakeProfit(),0,CLR_NONE)) { int err=GetLastError(); Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)); }//ordermodiy }//sell order }//select an order else {//in case it fails to select an order. int err=GetLastError(); Print("Encountered an error during order selection in: "+__FUNCTION__+"!"+(string)err+" "+ErrorDescription(err)); } }//for loop }
What is the error?????????
first of all you need to check values, your trailing points and broker's stoplevel
then you need to write down what is error ( in your journal tab )
Ye sorry this is the journal error
- Start with identifying which line gives you the message.
Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err) ); // 267 Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err) ); // 280 Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err) ); // 296 Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)); // 336 Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)); // 346 Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)); // 398 Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)); // 410
-
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can anyone please help me solve my EA trade modification error. The EA works fine but the error messages are driving me crazy trying to solve. please see the attached file for the EA