Invalid Parameters For Modification

 
Hello, anyone can check for me why I run this EA on strategy tester no problem, but once go for live, there is failed [Invalid parameters] for modification? Thanks
Files:
po_ea.mq4  3 kb
 
I have attached the live screen shot, pls check
 
I have attached the strategy tester screen shot
 
klhh:
Hello, anyone can check for me why I run this EA on strategy tester no problem, but once go for live, there is failed [Invalid parameters] for modification? Thanks


Your OrderModify() calls are wrong . . .  expiration cannot equal CLR_NONE

OrderModify(  OrderTicket(),    (Bid-distance-1)*Point, Bid,   0,   CLR_NONE);

 

 OrderModify (   int ticket,     double price,     double stoploss,     double takeprofit,    datetime expiration,     color arrow_color=CLR_NONE)

 
  1. If you write self-documenting code, you wouldn't have made such an error
    #define NO_TP 0
    #define NO_SL 0
    #define NO_EXPIRATION 0
    double OOP = (Bid - distance - 1) * Point,
           ISL = Bid;
    if (!OrderModify(OrderTicket(), oop, ISL, NO_TP, NO_EXPIRATION, CLR_NONE)
       ) Alert(... GetLastError());

  2. Always test your return codes, so you find out WHY is doesn't work What are Function return values ? How do I use them ? - MQL4 forum
  3. Bid = 1.2345, distance = 10, Point = 0.0001 so OOP = 0.0010 I don't think it will ever get that low.
  4. Not adjusting for 4/5 digit brokers.
 
thanks all of u, i have solved it...