Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, TipmyPip, VoroneTZ, Quad, 1 invisible), 688 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Multi-asset system questions #477813
07/30/19 18:12
07/30/19 18:12
Joined: Feb 2016
Posts: 15
Russia
nsg Offline OP
Newbie
nsg  Offline OP
Newbie

Joined: Feb 2016
Posts: 15
Russia
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:
Code
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:
Code
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:
Code
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:
Code
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:
Code
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!

Last edited by monadique; 07/30/19 18:27.
Re: Multi-asset system questions [Re: nsg] #477818
07/31/19 10:31
07/31/19 10:31
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Asset order matters:

https://manual.zorro-project.com/asset.htm

OptimalF is normally used to set Margin, but you can of course also set Lots by dividing with the margin cost.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1