Hi,
I have written a small package in order to control the equity of a portfolio strategy applied to each portfolio component and for the global Portfolio based on Rolling expectancy ratio.

The package improve the results of the test script disabling trading when the ReR drop below the given limit.

I am an average coder, learned programming at school and very influenced by the Pascal approach. I need help for testing and improve efficiency. Any "code upgrade "in this area is more than welcome.

The file includes a test script based on Zorro's WorkShop.

/*
Requires Zorro version >= 1.80.6
Equity control applied to each portfolio component and for the global Portfolio
based on Rolling expectancy ratio: ReR = ((AvgWin / AvgLoss) * WinRate) – (1 – WinRate)

Usage:
int checkAAEquity(int allAA, int sAA, var limit);

where
int allAA, # of trades used for ReR calculation all Algo/Asset considered - 0, no ReR Check
int sAA, # of trades used for ReR calculation for each Algo/Asset combination - 0, no ReR CCheck
var limit, Above limit: normal trading. Below limit, phantom trading

Example: checkEquity(30, 15, 0.0); // See run function below
For testing:
1 - Uncomment: #define TESTcheckAAEquity
2 - Train
3 - Test with checkAAEquity(0, 0, 0.0);
4 - Test with checkAAEquity(30, 15, 0.0);
5 - Enjoy

Reference:
https://www.financemagnates.com/forex/bloggers/equity-curve-trading-part-2-rolling-expectancy-ratio/
*/

Attached Files
mpEquityControl.c (25 downloads)
Last edited by MatPed; 04/09/18 11:35.