Issue with function calls in real account.

 
I dont know if the issue has alrady been dealt with, however I have a problem with the following function calls

SymbolInfoDouble(sybl,SYMBOL_VOLUME_MAX);
SymbolInfoDouble(sybl,SYMBOL_VOLUME_LIMIT);


in an EA in a real account.
In practice, the functions return zero in the real account, but in the demo MetaTrader work properly.
Where am  I wrong?
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
 
Serio:
I dont know if the issue has alrady been dealt with, however I have a problem with the following function calls

SymbolInfoDouble(sybl,SYMBOL_VOLUME_MAX);
SymbolInfoDouble(sybl,SYMBOL_VOLUME_LIMIT);


in an EA in a real account.
In practice, the functions return zero in the real account, but in the demo MetaTrader work properly.
Where am  I wrong?

You can try this, Volume Limit is specified by a particular value, such as :

Vol_Max = 5;

Vol_Limit = 25;

Not

Vol_Max = SymbolInfoDouble(sybl,SYMBOL_VOLUME_MAX);;

Vol_Limit = SymbolInfoDouble(sybl,SYMBOL_VOLUME_LIMIT);


 
achidayat:

You can try this, Volume Limit is specified by a particular value, such as :

Vol_Max = 5;

Vol_Limit = 25;

Not

Vol_Max = SymbolInfoDouble(sybl,SYMBOL_VOLUME_MAX);;

Vol_Limit = SymbolInfoDouble(sybl,SYMBOL_VOLUME_LIMIT);


Thank you for your answer. I do already like  you suggest.

My question was, what is wrong in the function call? If there is something wrong?

There is some reason we cant use this function call in real accounts? 

 
Is your sybl variable set properly? Currency pair names may be different in real and demo.
 
Serio:

Thank you for your answer. I do already like  you suggest.

My question was, what is wrong in the function call? If there is something wrong?

There is some reason we cant use this function call in real accounts? 

I think brokerage not specify a particular value for Vol_Limit while Vol_Max commonly specified.

May be there is a better answer from another forum's member or moderator.

 

Hi all,

i was hoping that this issue will not be present on real accounts.
This happens as broker didn't define a value.
I have seen on 3 different demo accounts different values not being defined. 

So, this problem demands that in OnInit() you check all values you are going to use against not being defined.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 
graziani:

Hi all,

i was hoping that this issue will not be present on real accounts.
This happens as broker didn't define a value.
I have seen on 3 different demo accounts different values not being defined. 

So, this problem demands that in OnInit() you check all values you are going to use against not being defined.

 

It is as you say, problem is that there are many brokers that do not define these values.
I solved the problem as you suggested.

Now my EA <edited> has been updated to work properly on any account.

Thank you.

 
Serio:
It is as you say, problem is that there are many brokers that do not define these values.
I solved the problem as you suggested.

Now my EA <edited> has been updated to work properly on any account.

Thank you.

You may not promote your product in forum, you will get a warning by moderator.
 
achidayat:
You may not promote your product in forum, you will get a warning by moderator.

Edited. Thank you.


Serio:
It is as you say, problem is that there are many brokers that do not define these values.
I solved the problem as you suggested.

Now my EA <edited> has been updated to work properly on any account.

Thank you.

 Serio, perhaps you'd like to show the mql5 code, how you solve this. After all you create this topic.

 
phi.nuts:

 Serio, perhaps you'd like to show the mql5 code, how you solve this. After all you create this topic.

double position_max = SymbolInfoDouble(sym, SYMBOL_VOLUME_LIMIT);
position_max = position_max == 0.0 ? SymbolInfoDouble(sym, SYMBOL_VOLUME_MAX) : position_max;
 
phi.nuts:

Edited. Thank you.


 Serio, perhaps you'd like to show the mql5 code, how you solve this. After all you create this topic.

First I would like to apologize for posting the link. I'll never make this mistake.
Coming back to the issue at hand, as I said I followed the suggestions by achidayat   and graziani.

My solution is:


  ...

  double Max_Lot, Tot_Max_Lot;

  ...

  if (SymbolInfoDouble(sybl,SYMBOL_VOLUME_MAX) > 0)   Max_Lot       = SymbolInfoDouble(sybl,SYMBOL_VOLUME_MAX);
  else Max_Lot         = 5;
  if (SymbolInfoDouble(sybl,SYMBOL_VOLUME_LIMIT) > 0) Tot_Max_Lot   = SymbolInfoDouble(sybl,SYMBOL_VOLUME_LIMIT);
  else Tot_Max_Lot   = 15;


The limits of 5 and 15 are those of the championship.

Thanks again to all and forgive me again.


Reason: