Order Modify Error 130 - Invalid Stops

 

Hey MQL4ers

Having trouble with my trailing stop function.

Can someone please clarify ALL situations that lead to this error?

Aware of traditional Stop too close to market which is definitely not issue and stop in wrong format, which should also not be an issue... I don't think I need help with code at this stage but will post if need be... I'd rather this topic to be definitive guide to 130 errors (as opposed to ANOTHER code specific fix!).

Regards,

Oscar.

 
shyftus:

Hey MQL4ers

Having trouble with my trailing stop function.

Can someone please clarify ALL situations that lead to this error?

Aware of traditional Stop too close to market which is definitely not issue and stop in wrong format, which should also not be an issue... I don't think I need help with code at this stage but will post if need be... I'd rather this topic to be definitive guide to 130 errors (as opposed to ANOTHER code specific fix!).

Regards,

Oscar.



Please show your code if you need coding help.
 
shyftus: Having trouble
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. No code, no market values, no order values, no mind readers: No answers.
 

1. This info should already be in the handbook

3. I did not ask for help with my code or ask anyone to be a "mind reader" - in fact the exact opposite, I do not want anyone reading my mind (or my code for that matter!)

2. I really don't see how my code has any bearing on the question's answer... in what scenarios (other than the ones already listed) does MT4 server return a 130 error?


 
  1. It is

    StopLoss and TakeProfit levels cannot be too close to the market. The minimal distance of stop levels in points can be obtained using the MarketInfo() function with MODE_STOPLEVEL parameter. In the case of erroneous or unnormalized stop levels, the error 130 (ERR_INVALID_STOPS) will be generated.

    At placing of a pending order, the open price cannot be too close to the market. The minimal distance of the pending price from the current market one in points can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. In case of false open price of a pending order, the error 130 (ERR_INVALID_STOPS) will be generated.

  2. Because your code is broken. Print your variables and find out why.
  3. Having trouble with my trailing stop function. Can someone please clarify ALL situations that lead to this error?
    There are infinite variations. You provided nothing of information, therefor you must expect mind readers here.
 
shyftus:

1. This info should already be in the handbook

3. I did not ask for help with my code or ask anyone to be a "mindreader" - in fact the exact opposite, I do not want anyone reading mymind (or my code for that matter!)

2. I really don't see how my code has any bearing on the question's answer... in what scenarios (other than the ones already listed) does MT4 server return a 130 error?

These informations are in the documentation/book, you just have to read it.
Reason: