MODE_STOPLEVEL Problem

 

As title says, i'm having some problem placing BUYSTOP/SELLSTOP order sometimes, i get Error 130 (ERR_INVALID_STOPS), probably related to MarketInfo("EURUSD",MODE_STOPLEVEL).

 

My broker return 0 as value from MarketInfo("EURUSD",MODE_STOPLEVEL), i tried to correct the OrderSend price adjusting it with Stop Level, also Stop Loss is beign adjusted when modified, but since the value i get is 0, how can i solve this?

From documentation i read also this "A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. In the second case, GetLastError() can return error 130, because MODE_STOPLEVEL is actually "floating" here.

So what should i do if the second case, is my case? 

 

I got also an Error 3 (INVALID TRADE PARAMETERS) trying to modify a BUYSTOP order already opened, could be this related to the same problem?

 

When an OrderSend fails, print out the error, the entry price SL and TP, current Bid/Ask. As much information as you need to find the cause of the problem.

Invalid stops can apply to the TP as well as the SL.

Make sure that TP is above entry and SL is below entry-spread for a buy. Opposite for a sell.

 
GumRai:

When an OrderSend fails, print out the error, the entry price SL and TP, current Bid/Ask. As much information as you need to find the cause of the problem.

Invalid stops can apply to the TP as well as the SL.

Make sure that TP is above entry and SL is below entry-spread for a buy. Opposite for a sell.

 I'll try to check everythign again. 

The error i get are described in my first post and i'm getting it when i'm using OrderSend with tp and sl equal to 0, i'm pretty sure the problem is that i get no Stop Level value, so i can't adjust entry price, accordingly. 

The documentation says that if i get 0 from  MarketInfo("EURUSD",MODE_STOPLEVELmeans either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. In the second case, GetLastError() can return error 130, because MODE_STOPLEVEL is actually "floating" here".

 

If my broker use some external mechanis, for dynamic level control how can i adjust my Logic to make it work everytime?