Download MetaTrader 5

Stoplevel is always 0 (demoAccount)

To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Harald Duftschmied
66
Harald Duftschmied 2013.03.22 10:21 

Hi,

I got some troubles calculating the StopLevel - here is my code:


double currPrice = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
double point = SymbolInfoDouble(_Symbol,SYMBOL_POINT);
double stopLevel = SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL) * point;
double stopPrice = currPrice + stopLevel;


I don't think there is an error in the code (taken from Andrew R. Youngs MQL5 Book).

Can it be that the stopLevel for my demo-account (FXCM-MT5Demo01) is set to 0 on purpose (to ensure better expirience for the trader or so) ? Or am i doing something wrong ?


Greetings,

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Symbol Properties - Documentation on MQL5
Alain Verleyen
Moderator
30737
Alain Verleyen 2013.03.22 10:47  
Distinctive:

Hi,

...

I don't think there is an error in the code (taken from Andrew R. Youngs MQL5 Book).

Can it be that the stopLevel for my demo-account (FXCM-MT5Demo01) is set to 0 on purpose (to ensure better expirience for the trader or so) ? Or am i doing something wrong ?


Greetings,

SYMBOL_TRADE_STOPS_LEVEL is set by broker and can be 0. It is up to you to adpat your code to manage this fact.

This may help you.

Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.03.22 11:36  
Distinctive:

Hi,

I got some troubles calculating the StopLevel - here is my code:


double currPrice = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
double point = SymbolInfoDouble(_Symbol,SYMBOL_POINT);
double stopLevel = SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL) * point;
double stopPrice = currPrice + stopLevel;


I don't think there is an error in the code (taken from Andrew R. Youngs MQL5 Book).

Can it be that the stopLevel for my demo-account (FXCM-MT5Demo01) is set to 0 on purpose (to ensure better expirience for the trader or so) ? Or am i doing something wrong ?


Greetings,

STOPS_LEVEL  !=  your chosen StopLoss,  it governs where your Stop Loss can be but does not determine it.

This may help,  it was written for MT4 but I think it also applies to MT5:   Requirements and Limitations in Making Trades

Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
  • book.mql4.com
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
Harald Duftschmied
66
Harald Duftschmied 2013.03.22 11:57  
angevoyageur:

SYMBOL_TRADE_STOPS_LEVEL is set by broker and can be 0. It is up to you to adpat your code to manage this fact.

This may help you.

Many thanks - that helps me.

@RaptorUK: I know that the STOPS_LEVEL does not determine the stoploss but sets the minimal difference to the Open-Price.

Thanks anyways :)

To add comments, please log in or register