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
Runtime Errors - Codes of Errors and Warnings - Standard Constants, Enumerations and Structures - MQL4 Reference
- docs.mql4.com
The GetLastError() function return last error code, stored in _LastError predefined variable. This value can be reset using the ResetLastError() function. Error code constants defined at stderror.mqh file. To print text messages use ErrorDescription() function defined at stdlib.mqh file.
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
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.