Discussion of article "Functions for Money Management in an Expert Advisor" - page 3

 
Todge:

Hi, Rosh

Thanks greatly for your article, and all of your other articles - advice and guidance for us MQL/C++ n00bs is hugely appreciated. Spasiba.

I am currently working on my own Money Management code, to enforce trading discipline and remove emotionally damaging fear and greed.

My philosophy is a little different in terms of selecting lot size - everything begins and ends with Money Management (MM).


I absolutely agree with you. This article does not pretend to be comprehensive and just strives only educational purpose.
 
Roche, I don't understand one thing. I run a multicurrency Expert Advisor in the tester, which works on all the chips of the championship and which has calls of GetMarginForOpening() function inside. Everything works perfectly. I run the single-currency Expert Advisor on EURUSD with the call of this function in the tester. Everything works! Now I run the same single currency Expert Advisor in the tester again, but now on EURJPY. In the journal of the Strategy Tester, the line with the text
GetMarginForOpening : Failed to find the currency of calculation for the symbol combination EURJPY
and even if the code in the GetSymbolByCurrencies() function is slightly changed to "symbolname = SymbolName(s, false);", still the initialisation of the MqlTick structure for EURUSD does not occur! so we get division by zero. Is it a glitch of the terminal or one call of GetMarginForOpening() function is not enough to get margin?
 
GODZILLA:

Now I run the same single-currency Expert Advisor in the tester again, but now on EURJPY. In the Strategy Tester log, a line with the text
GetMarginForOpening : Failed to find the currency of calculation for the symbol combination EURJPY
and even if I change the code in the GetSymbolByCurrencies() function to "symbolname = SymbolName(s, false);", still the initialisation of the MqlTick structure for EURUSD does not take place! Is it a glitch of the terminal or one call of GetMarginForOpening() function is not enough to get the margin?

Is there USDJPY currency in Market Watch?

Expression

symbolname = SymbolName(s, false);

provides access in the tester only to those symbols, which are available in the "Market Watch" window


 
Rosh:

Is there a USDJPY currency in Market Watch?

Expression

provides in the tester access only to those symbols that are available in the "Market Watch" window


That's the point, everything is there! It seems that the Strategy Tester for single-currency Expert Advisor has its own virtual "Market Watch" with only one symbol to open a position!

 
GODZILLA:

That's the point, everything is there! It seems that the Strategy Tester for single-currency Expert Advisor has its own virtual "Market Watch" with only one chip to open a position on!

The tester does have its own "Market Watch", which should be filled in when initialising the multicurrency Expert Advisor....

PS

And now the set of"Global Variables" in the tester is also its own (as far as I know)...

 
Interesting:

The tester does have its own "Market Overview", which must be filled in when initialising the multicurrency...

PS

And the set of"Global Variables" in the tester now has its own (as far as I know)....

Here we are talking about a single-slave tester. Well, let's assume that it was designed that way, but in such a situation it would be better to reflect this fact in the MetaEditor help, as it is not obvious for an inexperienced in programming user. And in the general case for a single-currency Expert Advisor the functions from this article will not work in single-currency Expert Advisors, if we overlook the preliminary initialisation of this farm.
 
GODZILLA:
It is just here that the conversation about the single-slots came up. Well, let's assume that this is the way it was designed, but in such a situation it would be better to reflect this fact in the MetaEditor help, as it is not obvious for a user not versed in programming. And in the general case for a single-currency Expert Advisor the functions from this article will not work in single-currency Expert Advisors, if we overlook the preliminary initialisation of this farm.
As far as I know, the case with symbols is as follows: each Expert Advisor has its own virtual "market overview". When testing in it, the symbol that is selected in the tester parameters automatically becomes active (I understand that the same mechanism is designed for TFs). If it is necessary to trade or analyse other pairs (multicurrency), the necessary symbols must be ACTIVISED (by selecting them with the true parameter).
 
Interesting:
If it is necessary to trade or analyse other pairs (multicurrency), the necessary symbols should be ACTIVISED (by selecting them with the parameter true).

Only it is necessary to keep in mind that symbols must be selected in the "Market Watch" window of the terminal before testing.


 

This is not  Money Management .

only how to get information about the most important characteristics of the trading account and about the properties of financial instruments.

these information can be used to Money Management.
 

 
DxdCn:

This is not  Money Management .

only how to get information about the most important characteristics of the trading account and about the properties of financial instruments.

these information can be used to Money Management.
 

Of course it isn't. As you can see, even the author of the article named it "Functions for Money Management (...)". So I don't see a point in you remark.