Hi everyone,
I have two questions regarding systems that trade multiple assets simultaneously. Consider an algorithm that produces the following results after optimization/WFO on Asset A and Asset B separately:
Asset A:
Number of trades 113 (34/year, 1/week, 0/day)
Percent winning 46.9%
Max win/loss 61.16$ / -50.25$
Avg trade profit 3.81$ 48.0p (+255.3p / -135.2p)
Avg trade slippage 0.0161$ 0.2p (+3.1p / -2.3p)
Avg trade bars 176 (+261 / -100)
Max trade bars 1039 (8 weeks)
Time in market 100%
Max open trades 1
Max loss streak 5 (uncorrelated 8)
Annual return 61%
Profit factor 1.67 (PRR 1.27)
Sharpe ratio 1.00
Kelly criterion 1.63
Standard Deviation 61.02%
R2 coefficient 0.000
Ulcer index 11.3%
Asset B:
Number of trades 111 (33/year, 1/week, 0/day)
Percent winning 42.3%
Max win/loss 66.33$ / -137$
Avg trade profit 3.16$ 39.2p (+295.1p / -148.8p)
Avg trade slippage -0.0206$ -0.3p (+3.3p / -2.8p)
Avg trade bars 164 (+259 / -94)
Max trade bars 1265 (10 weeks)
Time in market 100%
Max open trades 1
Max loss streak 5 (uncorrelated 9)
Annual return 46%
Profit factor 1.46 (PRR 1.11)
Sharpe ratio 0.76
Kelly criterion 1.25
Standard Deviation 60.64%
R2 coefficient 0.658
Ulcer index 11.5%
So I'm using an asset loop to enable the algorithm to trade both assets in a single script like this:
function run() {
//...
while(asset(loop("AssetA", "AssetB"))) {
// Price series, optimization calls, entry logic here
}
}
Now I'm doing WFO again on these two. And here comes the first question: when I have Asset A as first asset in the loop, I receive this:
Number of trades 200 (59/year, 1/week, 0/day)
Percent winning 41.5%
Max win/loss 66.33$ / -137$
Avg trade profit 2.09$ 26.0p (+275.7p / -151.1p)
Avg trade slippage -0.0093816$ -0.1p (+3.2p / -2.5p)
Avg trade bars 183 (+295 / -103)
Max trade bars 1265 (10 weeks)
Time in market 200%
Max open trades 2
Max loss streak 8 (uncorrelated 11)
Annual return 28%
Profit factor 1.29 (PRR 1.05)
Sharpe ratio 0.55
Kelly criterion 1.09
Standard Deviation 50.76%
R2 coefficient 0.000
Ulcer index 18.4%
And when I have Asset B as a first one, this:
Number of trades 208 (62/year, 1/week, 0/day)
Percent winning 43.8%
Max win/loss 88.84$ / -90.87$
Avg trade profit 2.91$ 36.4p (+278.0p / -151.6p)
Avg trade slippage 0.0077474$ 0.1p (+3.1p / -2.2p)
Avg trade bars 190 (+289 / -113)
Max trade bars 1189 (10 weeks)
Time in market 200%
Max open trades 2
Max loss streak 9 (uncorrelated 10)
Annual return 36%
Profit factor 1.43 (PRR 1.17)
Sharpe ratio 0.82
Kelly criterion 1.83
Standard Deviation 44.66%
R2 coefficient 0.000
Ulcer index 17.4%
Number of trades in simulation period is increased, trades for both assets are listed in the log, but still how do I interpret this result? Shouldn't it be more like an averaged one regardless of position of a particular asset in the asset loop?
Second question. In the manual on Z systems it's said that for some of them OptimalF is used for distributing margin among the traded components. So how do I use OptimalF for calculating position sizes (in lots) e.g. for system described above? I tried to set FACTORS flag, but according to the log it's always just one lot. The manual does a great job on describing how to do it in systems which reinvest profit, but I don't need reinvesting here.
Thanks!