Anyway to continue after 130?

 

Hi,

My broker does not return a value for MarketInfo(Symbol(), MODE_STOPLEVEL).

So, I use a hard coded specific value for stoplevel. (Currently testing only one market).

Most of the time, this value works, but failed sometimes.

Is there any way to try modification again after the error 130?

I wanted to do something like this.

Your feedback is much appreciated!

 if (error == 130)

{

while(result == false)

{

c++;

newvalue = NormalizeDouble(c*Point, digiNum);

if (side == OP_BUY) loss = NormalizeDouble(price - (stLoss + newvalue), digiNum);

if (side == OP_SELL) loss = NormalizeDouble(price + (stLoss + newvalue), digiNum);

result = OrderModifyReliable(OrderTicket(), price, loss, OrderTakeProfit(), 0, CLR_NONE);

}

}
 
miko.szy:

Hi,

My broker does not return a value for MarketInfo(Symbol(), MODE_STOPLEVEL).

So, I use a hard coded specific value for stoplevel. (Currently testing only one market).

Most of the time, this value works, but failed sometimes.

Is there any way to try modification again after the error 130?

I wanted to do something like this.

Your feedback is much appreciated!

<deleted>

Please use the SRC button to post code . . .
 
miko.szy:

Hi,

My broker does not return a value for MarketInfo(Symbol(), MODE_STOPLEVEL).

Ask them to add it . . . if not find a better more competent Broker, I admit thats not an easy task.

The correct action to take when you have an error 130 is . . .

The attempt can be repeated only if the error occurred due to the price obsolescense. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed.

 
miko.szy:

Hi,



Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

 

Hi

Thank you for your feedback.

Will use SRC button to place source code next time!

 
miko.szy:

Hi

Thank you for your feedback.

Will use SRC button to place source code next time!


Give also the code where the error is coming from

if your broker is ECN and you send a buy with a stoplosslevel ....

 
miko.szy: Most of the time, this value works, but failed sometimes.
result = OrderModifyReliable(OrderTicket(), price, loss, OrderTakeProfit(), 0, CLR_NONE); 
  1. Did you select the ticket with OrderSelect before using OrderTicket and OrderTakeProfit?
  2. What is price. Is it OrderOpenPrice? If not you are trying to modify the price and that will result in 130. (Buy: error of the spread, Sell: any slippage.)