Custom Backtester to Allow/Block Trades from Multiple Watchlists

#1
Hello all,
I've tried and failed to code up what I'm looking to do so I came here for
some pointers. If this topic has been brought up elsewhere I apologize for
missing it in my searching.

Is there a way to cap the maximum number of positions taken from a specific watchlist during a backtest? For example I have 2 groups of securities, "Index" and "Sector", both of which are placed in a single watchlist (3 watchlists all together, Index, Sector and Combo). I then use a rotational strategy for signals. At all times I want to be holding the top 2 ranked securities from the "index" category and the top 2 ranked securities form the "sector" category.

However, I've noticed that at times it hold more than/less than 2 of a particular groups' securities due to positionscore ranking. After speaking
with Amibroker support I was told that the custom backtester can solve my
problem.

I'm still very new to using the custom backtester and my experience only goes so far as tweaking code I've found through trial and error. When looking
through the backtester documentation I couldn't find (or missed)
allowing/blocking trades from watchlists. Any help/pointers would be greatly
appreciated as I'm pretty lost. Thanks!
 

Similar threads