Broker Min Stop Level when testing to high (12pip)

 

Hi!


I have a problem with  brokers minimum stop level when strategy testing on MT5.


I used checking with

SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL)

When testing: The brokers minimum stop level is always 120 (means e.g. EURUSD 0.00120). When real trading: The brokers minimum stop level is always 0.0 -> Perfect!

This means my tests with low SL/TP are always inaccurate because I have to increase SL/TP at minimum to SYMBOL_TRADE_STOPS_LEVEL not to get invalid stops.

Is there any possibility to set the default SYMBOL_TRADE_STOPS_LEVEL to 0.0 when strategy testing?


Thanks!


Sojer

Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
  • www.mql5.com
Trade Server Return Codes - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Yes, it is in the tester that you can change the symbol properties:


 

Hey Vladimir,


thank you very much for the info!

I think there's a little bug there (MT5 5.00 build 3211 14 Feb 2022).

I opened the tested symbol configuration page as you showed. SL and TP were already zero. But after I closed this window with "OK" my SYMBOL_TRADE_STOPS_LEVEL is also zero!


Even if I didn't change anything - problem solved with your help - thanks a lot!!

 
TradingSojer # :


'Stop level' (or 'Freeze level) equal to zero - this can mean:

  • or is this level really zero
  • or this level is floating :) - in this case, it is customary to take the level equal to the spread * 3.0
 
TradingSojer #:

Hey Vladimir,


thank you very much for the info!

I think there's a little bug there (MT5 5.00 build 3211 14 Feb 2022).

I opened the tested symbol configuration page as you showed. SL and TP were already zero. But after I closed this window with "OK" my SYMBOL_TRADE_STOPS_LEVEL is also zero!


Even if I didn't change anything - problem solved with your help - thanks a lot!!

So you are basically saying your code reported a STOPS_LEVEL of 120 in the Strategy Tester and that just opening the symbol settings (where it was stated 0) and clicking "OK" leads to have 0 in your code on the next tester run ?

Are you sure ? Do you know how to reproduce it ?

 
Alain Verleyen #:

So you are basically saying your code reported a STOPS_LEVEL of 120 in the Strategy Tester and that just opening the symbol settings (where it was stated 0) and clicking "OK" leads to have 0 in your code on the next tester run ?

Are you sure ? Do you know how to reproduce it ?

Hi Alain,


Yes - i am sure.

I tried to reproduce it but even after a fresh install on another computer it do not showed up again (perfect zero when testing).

I don't know - I always updated my install into place, never made a clean reinstall. Maybe this is the cause for this strange behaviour.

I was challenging this problem since weeks now but the value was always 120. Until I opened the tester symbol config window and clicked ok. Mysically solved.


By the way  - I'm an IT specialist and I hate such inconsistent problem/solution when I can not find the source of the problem :)


I hope it will never show up again! :)

 
TradingSojer #:

Hi Alain,


Yes - i am sure.

I tried to reproduce it but even after a fresh install on another computer it do not showed up again (perfect zero when testing).

I don't know - I always updated my install into place, never made a clean reinstall. Maybe this is the cause for this strange behaviour.

I was challenging this problem since weeks now but the value was always 120. Until I opened the tester symbol config window and clicked ok. Mysically solved.


By the way  - I'm an IT specialist and I hate such inconsistent problem/solution when I can not find the source of the problem :)


I hope it will never show up again! :)

If it's not fixed you can be sure it will show up again, just maybe not for you but for someone else :-D

For weeks ? We are talking about a broker symbol and not a custom symbol right ?

Was your MT5 platform restarted during these weeks ? Do you switch to an other broker ?

 
Alain Verleyen #:

If it's not fixed you can be sure it will show up again, just maybe not for you but for someone else :-D

For weeks ? We are talking about a broker symbol and not a custom symbol right ?

Was your MT5 platform restarted during these weeks ? Do you switch to an other broker ?

Hi Alain,

the MT5 platform was restarted several times. But I didn't restart the computer for a long time. Didn't switch to another broker.

But FYI interesting behaviour:


1. Restarted MT5: SL zero


2. Restarted computer: SL shows up 120


3. Set SL to 0



4. Restarted computer again (several times): SL kept staying zero


Means I will just keep checking the SL with OnInit(). Can't find a proper solution otherwise... :) ;)

 
TradingSojer #:

Hi Alain,

the MT5 platform was restarted several times. But I didn't restart the computer for a long time. Didn't switch to another broker.

But FYI interesting behaviour:


1. Restarted MT5: SL zero


2. Restarted computer: SL shows up 120


3. Set SL to 0



4. Restarted computer again (several times): SL kept staying zero


Means I will just keep checking the SL with OnInit(). Can't find a proper solution otherwise... :) ;)

So if I understood well (point 2) after a second restart it suddenly goes back to 120 again without you changing anything ?

Are you using the "Overview" section to go to an old backtest results ?

What are the live settings (so not on Strategy Tester) for this symbol ? You said it was 0 right ?

 
Alain Verleyen #:

So if I understood well (point 2) after a second restart it suddenly goes back to 120 again without you changing anything ?

Are you using the "Overview" section to go to an old backtest results ?

What are the live settings (so not on Strategy Tester) for this symbol ? You said it was 0 right ?

Yes that's correct. After first restart the 120 value appear but I have checked before restart thats 0. On further restarts after changing back to 0 is was keeping 0.

Live setting is: 

Reason: