• Join us

Reliably prevent 'invalid stops'

To add comments, please log in or register
chris_turner
22
chris_turner  

Hi everyone.

I'm using the StopsLevel() and FreezeLevel() methods of the CSymbolInfo class to help calculate the minimum stop-level for an open position.  I'm getting 40pips returned in StopsLevel() for EURUSD so I'm subtracting 0.0004 from the ASK price before placing a BUY order.

My problem is that sometimes this still results in an 'invalid stops' error (10016).

I've spoken to my broker and they said that it's because the ASK price might be slightly different to the current market price at the time.

Has anyone else had experience with this? 

Is there a reliable way to calculate a minimum stop-level without risking an 'invalid stops' error in MQL5?

Thanks in advance

Chris

Alain Verleyen
38997
Alain Verleyen  
chris_turner:

Hi everyone.

I'm using the StopsLevel() and FreezeLevel() methods of the CSymbolInfo class to help calculate the minimum stop-level for an open position.  I'm getting 40pips returned in StopsLevel() for EURUSD so I'm subtracting 0.0004 from the ASK price before placing a BUY order.

My problem is that sometimes this still results in an 'invalid stops' error (10016).

I've spoken to my broker and they said that it's because the ASK price might be slightly different to the current market price at the time.

Has anyone else had experience with this? 

Is there a reliable way to calculate a minimum stop-level without risking an 'invalid stops' error in MQL5?

Thanks in advance

Chris

If you place the stoploss at the exact stoplevel you can have this error with a market order (not always but more or less often). Market price is moving you know.

A stoplevel of 0.0004 is not 40 pips but 4 pips or 40 points (the stoplevel is given in points). And by the way 4 pips is a lot, which broker is it ? Demo or live account ?

chris_turner
22
chris_turner  

Hi Alain,

I've been setting up my trades exactly as you have suggested but I still sometimes get invalid stops.

Juvenille Emperor Limited
Moderator
10657
Eleni Anna Branou  
chris_turner:

Hi Alain,

I've been setting up my trades exactly as you have suggested but I still sometimes get invalid stops.

That means that your broker has larger stop loss tolerance levels than the ones you are trying to establish.

Change either your stop loss levels or your broker, there are some brokers with zero stop loss tolerance levels.

chris_turner
22
chris_turner  

Thanks Eleni,

That was the sort of response I was looking for.

I think I'll research other brokers

Alain Verleyen
38997
Alain Verleyen  
chris_turner:

Thanks Eleni,

That was the sort of response I was looking for.

I think I'll research other brokers

With any broker if you try to place a stoploss at the stoplevel price, you will always get invalid stops error from time to time.

Of course the difference is a better broker will not fix a 4 pips stoplevel.

To add comments, please log in or register