Discussion of article "Controlling the Slope of Balance Curve During Work of an Expert Advisor"
Something about the illustrations.
There are no illustrations, only captions.
But when testing, for some reason it hangs, as if you pressed pause, what is the reason?
"This is a kind of add-on over the EA's MM (money management), preventing itfrom making significant losses on the account."
Expression:
"// Lot limit from below:
if( lots < min_trade_volume )
{
lots = min_trade_volume;
}"
may allow.
See, for example, https://www.mql5.com/ru/forum/124281/page2#283533
- www.mql5.com
Did you read the article carefully?
One of the requirements for this version of the library is that the size of a normal working lot must be significantly (2-3 times at least) larger than the minimum allowed size
The piece you took out of context generally refers to normalisation of the working lot, so that you don't get an error because of an incorrect size.
You might want to read the link.
It's a common mistake.
And a link for you to read would be helpful.
It is a common mistake.
Here, I'm posting it with a correction - while the old version is in the article.
The article has also been updated.
When the volume of a trade is changed, for "normalisation" or for other purposes, the total risk value changes.
This is the attitude.
Besides, it is stated: "This method returns the lot value closest to the bottom ."
And in the case of
"// Lot limit from below:
if( lots < min_trade_volume )
{
lots = min_trade_volume;
}"
the value closest from the top is returned, and it can differ many, many times...
An example of a simpler and more reliable calculation of trade volume can be found at https://www.mql5.com/en/forum/112782.
In particular:
"if ( SizeLimit >= MinLots )
{ int Steps = MathFloor ( ( ( SizeLimit - MinLots ) / LotStep ) ;
LotSize = MinLots + Steps * LotStep ; }
else LotSize = 0 ;
if ( LotSize >= MaxLots )
LotSize = MaxLots ;
"
Using the NormalizeDouble() function is unnecessary.
This method works for any values of minimum volume, step and decimal places.
I hope your finalised and corrected one does as well.
- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Controlling the Slope of Balance Curve During Work of an Expert Advisor is published:
Author: Dima