Reply

create Portfolio with strategies lot size propotional to portfolio balance

14 replies

nico1969

Customer, bbp_participant, community, 9 replies.

Visit profile

5 years ago #114508

Hello,

 

I’d like to know whether it’s possible to modify the individual strategies lot size when building a portfolio so that they are proportional to the portfolio balance evolution.

Indeed I have individual strategies for which lot size are propotional to the current account balane (or free margin). So when merging several such strategies, the impact of each individual strategy is not correct.

Let say I start with 10.000 EUR for start1 and for that balance, lot size is 0.1.

After 10% balance increase lot size is 0.11

Now I have a second strategy on same account. So start balance is identical 10.000 EUR. Same start lot size of 0.1.

But this strategy looses 10% during the same period. So lot size for individual strategy 2 will be 0.9

Now If I merge, start1 + strat2. I should be around 0 benefit so end balance 10.000 EUR, but start1 lots at 0.11 and strat2 lots at 0.9.

In reality both strats on same account at balance 10.000 EUR means 0.1 used for each.

 

If during portfolio creation, the lot size (+ commission, P/L, …) is (are) adjusted to the running account balance then the impact of mixing both stratégies together will be closer to reality.

 

Is there a way to do it by extension? Can you explain how to do it and get me started?

 

Could be an option to add in further versions of the product. Eventually Monte Carlo Analysis should also be adapted the same way to get statistics closer to portfolio/strategy reality. Indeed if the strategy analyzed with Monte Carlo uses lot sizes proportional to account balance, simply shuffling trades does not give a correct approximation of drown downs.

 

By the way I just bought the pro licence and I love the product. Another thing I’d like to see modify but is less important is to have the number of days for MonteCarlo prediction be a parameter that can be changed.

 

Best regards.

0

nico1969

Customer, bbp_participant, community, 9 replies.

Visit profile

5 years ago #135301

I’m upset about the behavior of support. This is not a open source software, and I have paid the software pro licence. I posted that question almost 3 months ago and got no answer. How not professionnal.

0

daveM

Subscriber, bbp_participant, community, customer, 111 replies.

Visit profile

5 years ago #135316

Perhaps not replied to because the application is far beyond the scope of the program at present.

 

I well know what you want, but the program would require a complete rewrite to accommodate your requests.

 

I have studied this for many months….. and pondered what is required..  It may actually demand so much memory that it would be too large for many users.

 

I wonder if you should be looking to do it yourself in excel and the reason I mention that is, there is no quick way to incorporate all of these features, it is like a separate application.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

5 years ago #135318

sorry for not replying sooner.

 

I think I understand what you want to achieve, but the problem is that it is not possible to compute real running account balance in QuantAnalyzer, because it can see only the final result of the trade, not the progress.

You have to realize that QuantAnalyzer doesn’t perform the actual backtest of the strategies, only a simulation using list of closed trades.

 

The problem is in overlapping trades – when one trade starts before some other is finished then the program doesn’t know what is the running account balance at the time this second trade is opening.

It would work only if there would be no overlapping trades, but that is not the usual case.

Mark
StrategyQuant architect

0

nico1969

Customer, bbp_participant, community, 9 replies.

Visit profile

5 years ago #135811

It is possible and not so complex as you think. You have to create a list of trades events with trade entries and trade closure. Not just one line per trade.

If you do that just like in the simulation reports, you don’t have any problem of overlapping trades anymore. You have an event timestamp that you can use to sort and calculate running balances and the different ratios.

 

We don’t need to know the evolution of currency rates, because balances are only modified by trade closure. If the money management was based on free margin or equity, that would not be possible without curreny rates. But with account balance we have all information we need.

 

Please answer a bit more quicly this time.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

5 years ago #135824

yes, this approach would work if you are interested in open account balance, not on account equity (which is account balance + open profit/loss) 

 

I was mistaken that we use account equity in Money management, while in reality we use account balance. But this is already implemented in Money Management feature of QuantAnalyzer. You can load your portfolio and recompute money management there and it works just like you described it.

 

When you are combining strategies to a portfolio it doesn’t recompute their sizes by default, it “only” combines its orders. So use Money management for what you want to achieve.

Mark
StrategyQuant architect

0

nico1969

Customer, bbp_participant, community, 9 replies.

Visit profile

5 years ago #135828

Thank you for your fast answer. But that is not the answer to my question. What I want is to mix 2 strategies and see the impact on an account that would have the 2 strategies applied to it.

 

What you propose is just to transform a fixed lot strategy into a proportional lot and see the impact on that strategy. This is completely different and it doesn’t help to analyse the impact of 2 strategies put into a portfolio.

Let’s take my example. 1 strategy has a loss of 50% starting from 10.000. The second strategy has a benefit of 50% starting from 10.000. If the loss happen first and then the gain. In the current portfolio creation you end-up with 10.000. But in reality your account evolves as the following: 10.000 -> 5.000 -> 7.500.

 

Please take the time to consider or even do some quick tests and you’ll realize what you propose is not the answer. Whithout that feature, portfolio buidling is just wrong if your individual simulated strategies are not fixed lot based.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

5 years ago #135844

sorry, I dont understand why this aproach wouldn’t work. 

What you want is to recompute trade sizes, and this is possible only by applying money management.

The program doesn’t know which money management you used when you mix two strategies into a portfolio.

 

Create portfolio from your two strategies, then use Money management to re-run the position sizing and it will do exactly what you want – it will compute the new trading sizes depending on the running account balance.

 

If the problem is that you use some special money management type you can create a snippet that computes it.

Mark
StrategyQuant architect

0

nico1969

Customer, bbp_participant, community, 9 replies.

Visit profile

5 years ago #135848

The program does not need to know about the money management. Money management is part of each individual strategy. When you build a portfolio, each strategy is influenced by the result of the previous one. With the method you propose there is no influence between strategies. Let’s take an example:

Strat1:

01/01 -> bal: 10.000

02/01 -> trade: 1 lot -> P&L: -5.000 -> bal: 5.000

Start2:

01/01 -> bal: 10.000

03/01 -> trade: 2 lots -> P&L: 5.000 -> bal: 15.000

 

portfolio:

01/01 -> bal:10.000

02/01 -> trade: 1 lot -> P&L: -5.000 -> bal: 5.000

03/01 -> trade: 2 lots -> P&L: 5.000 -> bal: 10.000

 

appy MM 5%, 1.0 lots

01/01 -> bal: 10.000

02/01 -> trade: 0.50 lot -> P&L: -2.500 -> bal: 7.500

03/01 -> trade: 0.37 lot -> P&L: 925 -> bal: 8.425

 

In reality If you mix both stratégies together on 1 account the result is:

01/01 -> bal: 10.000

02/01 -> trade: 1 lot -> P&L: -5.000 ->bal: 5.000

03/01 -> trade: 1 lot (2 lots * 5.000 / 10.000) -> P&L: 2.500 -> bal: 7.500

 

In reality MM is applied by each strategy individually and a good approximation is a proportion of account balance (should be free margin or equity but that is not possible to simulate).

 

Can you see the difference?

I took a quick look at the extensions, it looks like a createPortfolio method would need to be overloaded. Is it possible? Can you provide a skeleton or even the original code for the implementation so that I give a try to the modification I need?

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

5 years ago #135850

ok, I got you now. So you have different MM for every strategy, that’s why you cannot use Money Management to recompute it for portfolio as a whole.

 

sorry, createPortfolio() method is not public, we might make ti public in new version, but right now it is too complicated.

 

But there is another possibility, that I believe is easier.

 

If you have some way to distinguish between the strategies – for example using their comments or symbols they trade on, then you can write a custom Money Management snippet that will apply the correct money management formula depending on the strategy.

This way you can simulate it exactly.

 

But I got your idea about proportionally recalculating sizes in when combining strategies into portfolio, I think we’ll add it in one of the next updates.

Mark
StrategyQuant architect

0

nico1969

Customer, bbp_participant, community, 9 replies.

Visit profile

5 years ago #135851

I’m looking forward for such feature in the near future.

 

But your proposal will work for me indeed. I have EAs that integrate several algo already. Each algo has a different money management. So with the EA I can see the dependencies of different algos on the same currency pair. Now I’d like to see the dependencies on different currency pairs but MT4 does not support simulation on several currencies.

 

I’ll keep track of the running balance for each currency pair and compute ratios with current portfolio balance. I took a look at some money management samples. There is a mention of equity, but I guess this is really the account balance, am I right?

0

Dan

Customer, bbp_participant, community, 29 replies.

Visit profile

5 years ago #136950

ok, I got you now. So you have different MM for every strategy, that’s why you cannot use Money Management to recompute it for portfolio as a whole.

 

sorry, createPortfolio() method is not public, we might make ti public in new version, but right now it is too complicated.

 

But there is another possibility, that I believe is easier.

 

If you have some way to distinguish between the strategies – for example using their comments or symbols they trade on, then you can write a custom Money Management snippet that will apply the correct money management formula depending on the strategy.

This way you can simulate it exactly.

 

But I got your idea about proportionally recalculating sizes in when combining strategies into portfolio, I think we’ll add it in one of the next updates.

Hi Mark, I ran into this same situation when combining two strategies in QA using Fixed % MM as it isn’t proportionally recalculating the sizes when combining the strategies into one portfolio.  This doesn’t allow me to properly analyse my portfolio at all.  A dangerous limitation that I’m glad I was able to identify upfront. What solution if any will you provide to this issue so traders who want to use a Fixed % Money Management strategy with multiple strategies trading as 1 portfolio will have the necessarily tools to properly analyze their portfolio prior to live testing.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

5 years ago #137036

the only way to handle this is to add proportional recomputation of sizes when combining strategies into portfolio.

 

We’ll add it in one of teh next updates, but I cannot promise when exactly it will be released.

 

But I think this process could also work:

1. convert all strategies to fixed size money management

2. combine them to portfolio

3. use MM simulation on the portfolio to simulate Fixed % MM 

 

If I’m not mistaken this should create portfolio with the trades that are proportional.

Mark
StrategyQuant architect

0

Dan

Customer, bbp_participant, community, 29 replies.

Visit profile

5 years ago #137067

Hi Mark,

 

Thank you for responding to my message and with a work around to solve the problem. Notch Thanks for the QA snippet

0

Alejandro

Subscriber, bbp_participant, community, 0 replies.

Visit profile

3 years ago #197241

Hi.

I’d like to know if this feature is already implemented in the latest version of QA or if I still need a workaround in order to have reliable portfolio analysis

Thank you

0

Viewing 15 posts - 1 through 15 (of 15 total)