Discussion of article "R-squared as an estimation of quality of the strategy balance curve" - page 9

 

Thanks, dragged a piece of it away for myself :)



 

can someone fix the archive i got 30 errors

 

There's a lot of info here explaining the reasoning and your code, and I appreciate that. Here's the Tl;dr version for those of us for whom most of this went over our heads:

1. Add the includes

#include <Expert\Strategy\TimeSeries.mqh>
#include <Expert\Strategy\Strategy.mqh>

2. And the OnTester:

double OnTester()
{
   return CustomR2Balance();
}

That's it to implement it based on balance.

If your EA uses CStrategy (as the wizard EAs do), then add the same includes, and you can switch to the equity like this:

double OnTester()
{
   Manager.SetCustomOptimizeR2Balance(CORR_PEARSON);
   return Manager.OnTester();
}

What I have NOT figured out yet, and am hoping someone can help me with, is what to do to implement the equity listener in your own EA that's not based on CStrategy. All the article says is:

When it is necessary to calculate the strategy equity, however, users who do not employ CStrategy will have to do it themselves.

And I'm at a complete loss how to do that.
 
Fixed the errors. The archive is attached.
Files:
UnExpert.zip  117 kb
 
Artyom Trishkin #:
Fixed the errors. The archive is attached.

Thanks, updated the article.

 
zrwhiteley #:
That is genius. Thanks alot for the great article! I wonder how R2 measuring quality compares to measuring standard deviation from an account balance moving average.

It should be very similar... a comparison is on my long disorganised todo list!

 
Zeke Yaeger #:
Normalize the volume : Take the profit and divide by the lot size

Or divide balance[0] by balance[1] to get return, and calculate r^2 for the return curve