MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading and Strategy Testing Forum

Copy experienced traders' deals with Trading Signals
To add comments, please log in or register
Do you want to deposit to your account? Do this in any convenient way!
MetaQuotes Software Corp.
142146
MetaQuotes 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.

Author: MetaQuotes

Rosh
Admin
5667
Rosh 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
10235
song_song 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