ordermodify error 131 - take profit price error
Chihming Tsao:
would you please give me some hints to fix this error ?
This code section:
//if current price > tp if(OrderOpenPrice()>buy_tp && OrderTakeProfit()!=buy_tp ) { OrderModify(OrderTicket(),OrderOpenPrice(),buy_tp,0,0,White); }
Error 130 is invalid stop.
You are setting the STOPLOSS to the buy_tp value and setting the TP value to 0.
If this is a buy order, then you are setting the Stoploss at a greater value than the current price.
This means the price is below your stoploss value on a buy ticket.
In regard to Error 131.Error 131 is invalid lot size. Make sure you are using a lot size that is allowed for your account.
Error codes page: https://docs.mql4.com/constants/errorswarnings/errorcodes
And this one too: https://docs.mql4.com/constants/errorswarnings/enum_trade_return_codes
- docs.mql4.com
Hello,
I am going to use the highest price as take profit price,
ans set stop loss price = 0 always.
Sometimes the code runs well, sometimes it show error 130,
would you please give me some hints to fix this error ?
Thanks.