Error 1 : I guess you are trying to modify the same order and set the same SL, i.e. not modifying anything . .
Error 130 : this may help you https://book.mql4.com/appendix/limits
I think your MarketInfo call is wrong, shouldn't it be MODE_STOPLEVEL ? and maybe this MathAbs(Bid - SL_BUY) >= SL_Min should be change to this MathAbs(Bid - SL_BUY) > SL_Min
When you do the order modify do you update your _OrderStopLoss array with the new SL value ? I can't see it in your code . . .
I used below code to prevent modifying the same SL, I think it does have something to do with Array, its not updated. thanks for pointing out.
SL_BUY != _OrderStopLoss[n]
yes it is MODE_STOPLEVEL, wrong typing...
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
i keep getting OrderModification Error 1 and 130, but the ordermodification works perfectly, can some one help me find out why.
my code:
double SL_BUY = Low[iLowest(NULL, 0, MODE_LOW, 3, 1)]; //trailing stoploss
SL_Min = MarketInfo(Symbol(),Mode_StopLevel)*Point; // minimum stoploss distance
if( Bid > SL_BUY && MathAbs(Bid - SL_BUY) >= SL_Min && SL_BUY != _OrderStopLoss[n])
{
OrderModify(_OrderTicket[n], _OrderOpenPrice[n], SL_BUY, 0, 0, MediumSeaGreen); // ordermodify
}