Dynamic Position Sizing

Hi everyone,

I was wondering if someone could please help with the following, and/or direct me to where this has already been answered.

I am testing a system on a portfolio of just 3 ETFs. Buy and Sell signals can come on any bar. What I want to be able to do, is allocate 100% of equity irrespective of how many open positions there are, assuming there is at least 1 open position.

Meaning, when the 1st buy signal is triggered, I would use 100% of equity. If then a 2nd buy signal was triggered, the system would sell 50% of the current open position, and allocate 50% to the new trade.

It would also scale out. If say I had 3 positions open at 33.33% equity, and 1 position issued a sell. This position would be sold, and the available equity split 50/50 to the 2 remaining open positions, which would increase from 33.33% each to now 50% of equity each.

Any help would be appreciated.

Regards, Oliver.

1 Like

@OTG scaling up and down has been addressed in a few posts on this forum. Search with the magnifying glass in top right corner for scale or scaling.

From the knowledge base to get you started,

Here is one thread on this forum with many useful links,

For more specific help it would be useful to post your code so forum members can try to fix it. Remember to use proper code tags if you do.

Thanks portfoliobuilder,

I have dealt with this issue with rotational systems and using the custom backtester.

However as this system is not a rotational system, I thought that I may be able to deal with it using sigscalein and sigscaleout?

Thanks again.

@otg many of the posts in that thread, and several of the links in that discussion thread are not related to rotational systems. Just scaling in and scaling out. I think if you go through the posts and the links carefully you may find your solution (and will certainly learn a lot about scaling in AmiBroker). Best of luck.

Howard Bandy is the man to ask, but he seems to have disappeared from forums lately. Hopefully he’ll be back soon, but you can visit his website.

@OTG Since you have already dealt with this issue with rotational systems using the custom backtester, you could use a similar approach in your non-rotational system. It will be difficult to use the scale-in, scale-out approach in the phase 1 backtest because you usually do not have knowledge of the number of open positions during phase 1 when backtesting a portfolio.

Ok thanks Steve,

Yes, I have resorted to using the custom backtester. With the rotational system, I only had to deal with open positions, and check current position size relative to the initial position size.

With this system, I need to first assess the number of open positions and new entries or exits, and then assign position size.

I’ll keep working on it.

Regards, Oliver.

Hi @OTG,
Could you update how to deal with this system?
Thank you