Discussion of article "Controlling the Slope of Balance Curve During Work of an Expert Advisor"

 

New article Controlling the Slope of Balance Curve During Work of an Expert Advisor is published:

Finding rules for a trade system and programming them in an Expert Advisor is a half of the job. Somehow, you need to correct the operation of the Expert Advisor as it accumulates the results of trading. This article describes one of approaches, which allows improving performance of an Expert Advisor through creation of a feedback that measures slope of the balance curve.

Author: Dima

 

Something about the illustrations.

There are no illustrations, only captions.

 
A very good approach, in my opinion
 
But when testing, for some reason it froze, as if paused, what is the reason?
 
arbuz:
But when testing, for some reason it hangs, as if you pressed pause, what is the reason?
Sorry, there was a small inaccuracy in the sorting algorithm. The corrected library will appear now.
 

"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

Поясните, пожалуйста, как получается просадка - MQL4 форум
  • www.mql5.com
Поясните, пожалуйста, как получается просадка - MQL4 форум
 

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.

 
Ais:

And a link for you to read would be helpful.

It is a common mistake.

You are confusing risk management with simply bringing the working lot to a normalised value. If MM requires the current lot size to be significantly smaller than the minimum allowed, the position should not be opened at all. But what does this have to do with normalisation? (rhetorical question)
 

Here, I'm posting it with a correction - while the old version is in the article.


The article has also been updated.

Files:
 

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.

Calculation on Leverage & MM together in Expert Advisors. - MQL4 forum
  • www.mql5.com
Calculation on Leverage & MM together in Expert Advisors. - MQL4 forum