Download MetaTrader 5

Discussion of article "Limitations and Verifications in Expert Advisors"

To add comments, please log in or register
Enable MQL5 Storage to store your source codes. It is free!
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2010.08.03 18:50 

New article Limitations and Verifications in Expert Advisors is published:

Is it allowed to trade this symbol on Monday? Is there enough money to open position? How big is the loss if Stop Loss triggers? How to limit the number of pending orders? Was the trade operation executed at the current bar or at the previous one? If a trade robot cannot perform this kind of verifications, then any trade strategy can turn into a losing one. This article shows the examples of verifications that are useful in any Expert Advisor.

The messages of the CheckVolumeValue.mq5 that checks the volume to be correct.

Author: MetaQuotes

Rashid Umarov
Rashid Umarov 2010.08.18 10:16  

Due to changes in MQL5, now the maximal overall volume allowed for one symbol can be obtained as following:

//--- get symbol limitation for volume
   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_LIMIT);

Do not use the old variant! It was like this:

//--- get symbol limitation for volume
   double max_volume=AccountInfoDouble(ACCOUNT_LIMIT_VOLUME);
The article has been corrected and the new Check_Order_And_Volume_Limits.mq5 expert code has been attached to it.

Jinsong Zhang
Jinsong Zhang 2010.08.18 10:40  

(build 306)

void OnStart()
double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_LIMIT);


compile errors: 


 'SYMBOL_VOLUME_LIMIT' - undeclared identifier test.mq5 4 46
'SymbolInfoDouble' - no one of the overloads can be applied to the function call test.mq5 4 20

To add comments, please log in or register