Download MetaTrader 5
To add comments, please log in or register
Learn operation principles of Trading Signals for MetaTrader.
miko.szy
35
miko.szy 2014.02.14 03:29 

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);

}

}
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.14 09:56  
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 . . .
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.14 09:59  
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.

Alain Verleyen
Moderator
28701
Alain Verleyen 2014.02.14 10:26  
miko.szy:

Hi,



Hello,

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


This time, I edited it for you.

miko.szy
35
miko.szy 2014.02.15 09:32  

Hi

Thank you for your feedback.

Will use SRC button to place source code next time!

Tjipke de Vries
6284
Tjipke de Vries 2014.02.15 10:31  
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 ....

whroeder1
13656
whroeder1 2014.02.15 12:50  
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.)
/
To add comments, please log in or register