Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, Nymphodora, Quad, TipmyPip, Imhotep), 852 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Optimal F in a Portfolio – Does Zorro Overrisk? #466018
05/21/17 02:54
05/21/17 02:54
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Optimal F in a Portfolio – Does Zorro Overrisk?

Hi,
After reading Ralph Vince’s publications I believe that the implementation of Optimal F in workshop 6 is not correct and might, in case of a multicomponent portfolio, lead to excessive risk (we are far to the right of the peak of the optimal f curve).
When setting FACTORS the optimal fractions for re-investment are calculated and as the manual states, these factors are calculated independently for each asset and algo. This means that we get the optimal fraction for re-investment of each asset and algo if we only traded this one algo and asset on its own (e.g. in Workshop 6: we only trade the trend strategy on EUR/USD, results of USD/JPY and countertrend are ignored).
However, if we add additional strategies (algos) and assets to the script the optimal f from before is not optimal anymore in context of a whole portfolio due to correlations between the various components.
Ralph Vince’s uses a simple example in his paper “The Leverage Space Model” (p.19)
http://www.automated-trading-system.com/wp-content/uploads/2010/03/Vince-LeverageSpaceModel.pdf

He uses a coin-toss experiment were with tails one loses $1 and with head one wins $2. The probability of occurrence of either event obviously is 50%.
If we calculate optimal f we get a result of 0.25. This means that for maximum growth we have to invest $1 for every $4 at stake.
Now, if we extend this experiment and throw 2 (!) coins at the same time the optimal fraction to invest changes, even if there is NO correlation at all. In case of 0 correlation the optimal f would not be 0.25 anymore BUT 0.23 (if we invest the calculated 0.25 from before we already OVERRISK).

This gets worse in case that these two games are perfectly correlated (meaning that if one coin lands on head the other one will land on head too). In this case it would be the same as playing only one game. If we invested in each game the optimal f that we calculated for the isolated game (that is, optimal f = 0.25) we’d effectively invest 0.5 not 0.25 anymore (as described above, in case of a perfect correlation, the two coin tosses that we perform at the same time can be seen as 1). Looking at the optimal f curve (figure 12 in the paper) we are far to the right of the optimal f value if we invest 0.5 and consequently severely OVERRISK.

My question to the Zorro developers is whether I am missing something or whether there is a specific reason of why optimal F is implemented in such a way in workshop 6.
I specifically refer to (Margin = 0.5 * OptimalF * Capital * sqrt(1 + ProfitClosed/Capital))
As ProfitClosed calculates the profit for each component separately (and thus, effectively creates separated sub-accounts for each algo/asset component) would you suggest to split the initial capital into X parts as well? Through this procedure it would not be required to implement the Leverage Space Model which considers joint probabilities of trade results of X components.

Thanks in advance.
Cheers

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: Ger1] #466371
06/12/17 08:42
06/12/17 08:42
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
A good observation. The reason why OptimalF reduces from 0.25 to 0.23 in uncorrelated events is that you toss the two coins at the same time. If you would toss them a time apart, the capital change from the first toss would affect the investment in the second toss and therefore the OptimalF factor would be again 0.25.

In Workshop 6, a coin toss is equivalent to opening a trade. Since trades are normally opened at different times, it's a situation more equivalent to uncorrelated single coin tosses than to multiple simultaneous coin tosses. The analogy is not perfect because trades overlap, but due to the 0.5 factor we don't overrisk.

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: jcl] #466496
06/17/17 23:26
06/17/17 23:26
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Thanks for your reply jcl.

Your statement would make sense to me if only a very small number of algos/assets with no correlation were traded.

I am fully aware that a simultaneous coin toss play does not completely represent trading due to different timing of events, but to illustrate the point I'd like to use it for an extreme example.

As mentioned above, we evaluated that the optimal F for the coin toss experiment (I will call it market system A) is 0.25. Now I am trading further strategies (I'll call them market system B, C and D) and incidentally the optimal F is 0.25 too. Further the largest loss for all market systems is $1.

Again, this means for each trade I put in $1 for every $4 I got in my stake (OptimalF/Largest Loss * Balance). In case that market systems A - D have a trade open at the same time, 100% of my trading capital are invested.

All that is required to wipe out my entire account is all 4 market systems having their largest loss at the same time.
Unless my market systems are completely anti-correlated this won't take too long. Now it might be argued that trades are usually not opened at the same time, but if one system opens a trade and another system has not closed the trade yet this has exactly the same effect as I could not re-balance my account yet.

This is an extreme case but it illustrates the point that optimal F of a single system traded alone is not the same as the optimal F of that system traded in combination with other systems in a whole portfolio.

And as Ralph Vince states (he uses 10 strategies over 10 markets ==> 10*10 = 100 components), I could be optimal on 99 of these 100 components, yet so far off on one component on the Leverage Space that I am losing money.

A quick and dirty solution according to this article (http://www.futuresmag.com/2012/05/31/managing-portfolio-risk-leverage-space?page=5) is to assume the worst case scenario that all correlations of all of the markets in our portfolio go to 1.00.

Optimal F of each market system would then be the optimal F of each market system traded alone divided by the total number of market systems in our portfolio.

From my example above, the optimal F of market systems A - D would then not be 0.25 for each but 0.0625 (0.25/4).

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: Ger1] #467105
07/16/17 00:30
07/16/17 00:30
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Any feedback on above??

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: Ger1] #467122
07/17/17 09:25
07/17/17 09:25
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Same answer as above. It depends on whether the systems are always in the market or only trade punctually. If they are always in the market, you must treat them as separate systems and reduce the capital accordingly. If they only trade punctually, you can treat them as a single system and trade with all your capital.

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: jcl] #467145
07/18/17 07:18
07/18/17 07:18
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Thanks a lot jcl! This makes sense to me.

From your experience, what is the best way to achieve this?

Would you do something like this?

Margin = .5*OptimalF*Balance/NumOpenTotal;

In other words decreasing your trade size based on how many trades are open.

Or would it be better to limit the total trade number to rather than reducing risk per trade?

Cheers

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: Ger1] #467170
07/19/17 07:33
07/19/17 07:33
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No, I would not use an algorithm at all for reinvesting in live trading mode. You normally want manual control over reinvestment, so in all trade systems that I know you manually enter the invested capital. OptimalF is then used only for distributing the capital among the assets and algos of the portfolio.

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: jcl] #472888
05/28/18 13:44
05/28/18 13:44
Joined: May 2018
Posts: 3
N
nemozny Offline
Guest
nemozny  Offline
Guest
N

Joined: May 2018
Posts: 3
I can't agree with trading in optimal f in independent mode (jcl says "If they are always in the market, you must treat them as separate systems and reduce the capital accordingly."), so as strategies doesn't relate one to another and you trade them as independent systems (0.25f in the discussion above).
1. For daily trading the positions are open at the same time for different systems, I don't think the entry moment is valid argument here. The strategies influence one another in capital perspective.
If optimal f means optimal capital allocation, you cannot ignore capital dependencies.
One intraday and one daily trading system is a different thing, I am not arguing that.
Intercorrelation in the perspective of the modern (tangent) portfolio is irrelevant here.
2. Calculating optimal f in LSPM mode (0.23f in example above) produces the optimal f for every each one of the strategies to obtain highest geometric growth together, so there cannot exist any different (lower) value, contrary to distributing optimal f via the number of systems (out of total) produces very different results (suboptimal to LSPM result - more evenly distributed, probably).
3. I gathered the information from several Vince's books and I found a little light in each of them. In LSPM book the calculation is illustrated in detail there and Vince always takes individual probabilities (of trade occurring) in account in the calculation, though he says you can aggregate the profits on daily, weekly, monthly periods/bins, it doesn't matter.
So again, time of entry is irrelevant.
4. I tested my LSPM calculation taking systems A, B, C and entering them multiple times into calculation - i.e. [A, B, A, B, C], so simulating 5 systems (to prove my algo can handle). The results are of course that optimal f for original 3 systems [0.37, 0, 0.63] are EQUAL to results from 5 systems, although my algo distributes the sums a little [0.3, 0, 0.07, 0, 0.63]. Summing each A, each B, C produces [0.37, 0, 0.63] again.
This proves that correlation is irrelevant, only maximum geometric growth matters here.
5. I am not arguing Zorro's version here, I think you just changed the capital to squared capital.
6. I was not satisfied with genetic algorithm calculation speed and accuracy, so I am calculating optimal f with increasing accuracy and narrowing from 0.1 -> 0.01 -> 0.001, so my results should be pretty accurate.

I am not an expert though, I just spent the last 3-4 weeks studying Vince's work.
And I have to say there is a TON of misconception about optimal f out there.

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: nemozny] #473043
06/11/18 08:03
06/11/18 08:03
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Thanks nemozny. Very good points, however I have different a conclusion about point (4).
To me it rather proves that correlation is indeed important.
Going to your example and trading [A, B, A, B, C].
Obviously the two A systems have a correlation of exactly 1. Due to this, the sum of the optimal Fs of the two A systems is equal to trading only one A system [A, B, C].

If correlation were smaller than 1, the sums of the individual optimal Fs of trading [A, B, A, B, C] would be greater than trading [A, B, C].


Going back to point (2), you are definitely right that dividing the individual optimal Fs by the total number of systems leads to suboptimal results but you are at least on the safe side as you assume a correlation between the systems of 1 (as discussed above).

Because of that, I think that optimal F as it is used in the workshop scripts probably overrisks when trading multiple assets and algos and it would be better to either calculate optimal F with the LSPM or divide the individual optimal Fs by the total number of assets and algos.

I also wonder if you could share the optimal Fs of trading each system on its own.

Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: Ger1] #473467
07/10/18 14:24
07/10/18 14:24
Joined: May 2018
Posts: 3
N
nemozny Offline
Guest
nemozny  Offline
Guest
N

Joined: May 2018
Posts: 3
Ger1, (4) You are right, A and A is correlated to 1. What I meant was that you need not to observe the correlations, as optimal f calculation itself will find the extreme on the n-dimensional surface of all possible variations of individual f's.

(2) As per Ralph Vince, you are always on the safe side with the optimal f calculation considering trading in the infinite horizon. Because optimal f for 1 dice roll > optimal f (2 dice rolls) > optimal f (3 dice rolls). Limiting number of rolls beforehand will force optimal f higher, to produce maximum outcome under constraints.
What you are doing here is trying to be on the "safer than safe" side. And inherently falling off the course totally.

"I think that optimal F as it is used in the workshop scripts probably overrisks when trading multiple assets and algos" - Yes, precisely! This way you are also allocating resources proportionally into algos that don't yield the total desired outcome. LSPM would avoid those entirely (optimal f = 0).
But again, you can stay on the safer than the safe side.

what do you mean by "I also wonder if you could share the optimal Fs of trading each system on its own." ?

Last edited by nemozny; 07/10/18 14:27.
Re: Optimal F in a Portfolio – Does Zorro Overrisk? [Re: nemozny] #473468
07/10/18 14:45
07/10/18 14:45
Joined: May 2018
Posts: 3
N
nemozny Offline
Guest
nemozny  Offline
Guest
N

Joined: May 2018
Posts: 3
Ok, to be a little constructive here, if you feel you have to adjust the allocation among the algos (please read "avoid allocating all capital to a single algo"), then you should add constraint to LSPM algorithm.

Or more specifically - while finding the global extreme for all combinations of individual optimal Fs, you can constrain the matrix to avoid individual Fs i.e. > 0.4.

OK: 0.3, 0.3, 0.4
OK: 0.0, 0.2, 0.2
NOK: 0.1, 0.4, 0.5

This way you can find the global extreme under constrains.

Disclaimer: I pulled this of the top of my head, I didn't yet read Vince's books till the end.

Last edited by nemozny; 07/10/18 14:46.
Page 1 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1