How to get closest Stoplevel

 

Hello,

Have a position for Symbol x and need to know the closes StopLevel that would be accepted by trade server.

How to do this ?

Thank you 

 
I am not on my computer now so I cannot give you detailed answer but look for SYMBOL_TRADE_STOPS_LEVEL from documentation might help you.

Br, Candles
 
Candles:
I am not on my computer now so I cannot give you detailed answer but look for SYMBOL_TRADE_STOPS_LEVEL from documentation might help you.

Br, Candles
 . .  and bear in mind the Spread,  if your STOPS LEVEL is 0 you still can't set your SL closer than the Spread.
 
Candles:
I am not on my computer now so I cannot give you detailed answer but look for SYMBOL_TRADE_STOPS_LEVEL from documentation might help you.

Br, Candles
What Candles mean was SymbolInfoInteger's SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL
 

Thank you,

so

Bid - SYMBOL_TRADE_STOPS_LEVEL for long position

and

ASK + SYMBOL_TRADE_STOPS_LEVEL  for short position

Should do it. 

Reason: