the error 130 (ERR_INVALID_STOPS)

 

Can someone find out what is wrong with this ordersend function...I am seeing error 130 in the experts tab.

OrderSend(Symbol(),OP_SELL,MarketInfo(Symbol(),MODE_MINLOT),Bid,5,NormalizeDouble(Ask+350*Point,Digits),0,"Sell",1234,0,Tomato);

I am able to run this EA successfully on a demo account with another broker....but when it comes to this broker's demo account, the ordersend function is giving error 130. Not sure whether this matter, but thought I would bring it up.

 
Tom23824:

Can someone find out what is wrong with this ordersend function...I am seeing error 130 in the experts tab.

OrderSend(Symbol(),OP_SELL,MarketInfo(Symbol(),MODE_MINLOT),Bid,5,NormalizeDouble(Ask+350*Point,Digits),0,"Sell",1234,0,Tomato);

I am able to run this EA successfully on a demo account with another broker....but when it comes to this broker's demo account, the ordersend function is giving error 130. Not sure whether this matter, but thought I would bring it up.

Someone else may well have a definitive answer, but three things spring to mind:

  • Is one broker using 4 decimal places and the other using 5 decimal places? If so, 5 pips of slippage isn't a lot to allow if the broker is quoting prices to 0.00001.
  • Does the broker simply have a rule about the minimum amount of slippage you're allowed to specify?
  • Does it make a difference if you do a RefreshRates() before the order placement to make sure that Bid/Ask are as up-to-date as possible?

 

I would refer you to the following, should you not have read yet.

Order Characteristics and Rules for Making Trades...

and

Requirements and Limitations in Making Trades

Also,

liberal use of Print() will help you to get a handle on just what it is in the calls actuals that you are passing to a function, yes?

Good Hunting...

 
jjc:

Someone else may well have a definitive answer, but three things spring to mind [...]

I think fbj may be politely and obliquely implying that my suggestions are unlikely to be right. On reflection, problems such as the ones I'm suggesting should lead to error #129, not error #130.

 
Tom23824 wrote >>

Can someone find out what is wrong with this ordersend function...I am seeing error 130 in the experts tab.

OrderSend(Symbol(),OP_SELL,MarketInfo(Symbol(),MODE_MINLOT),Bid,5,NormalizeDouble(Ask+350*Point,Digits),0,"Sell",1234,0,Tomato);

I am able to run this EA successfully on a demo account with another broker....but when it comes to this broker's demo account, the ordersend function is giving error 130. Not sure whether this matter, but thought I would bring it up.

After posting the post, few topics were listed below that discussed similar issue...Checked one old topic that was responed by Phy...'a question for ERR_INVALID_STOPS'.

Made the change in ordersend and then added a ordermodify code. Later the order went through without issues. my thanks to Phy.

But then comes the point, How many things are different from one broker to another even though they use this standard MT4 platform and the mql language?

 
Tom23824:

But then comes the point, How many things are different from one broker to another even though they use this standard MT4 platform and the mql language?

Personally, I've only come across problems such as this - having to place stops and profits independently from an opening market order - when dealing with the likes of Boston Technologies as a bridge into heavyweight prime-brokerage houses.


I'm very surprised if you're having this particular issue with a common-or-garden MetaTrader broker. The need to place stops and profits independently from opening market orders is entirely normal for a non-OTC environment such as trading forex futures but, perhaps naively, I'm surprised if you're saying that there's (a) a brokerage which provides MetaTrader services, but (b) without fully signing up to the weird MetaTrader world where there aren't any true market orders, OCO orders, last-trade prices, etc.

Reason: