Trading once a month with IB

Greetings all,

I want to use one of my ranking systems to start trading once a month. Of course, currently the ranking and simulation backtests allow for rebalancing every 4 weeks. This means that if I would use the holdings of the simulation output each month through the API, the rebalancing and trading would not be synchronised. Currently, the buy and sell rules are simple: buy if dollarvolume > 500000 and Price > 1, sell if rank < 95

Let’s say I believe that I can roughly extrapolate the results of the simulation from every 4 weeks to every month (for convenience) and I want to implement the strategy in practice.

Can I simply do the following each month?
(1) import the (new) holdings of the ranking (so not the simulation, but the ranking) through the portfolio123 API
(2) check if any of the current holdings have fallen below rank 95 and if so, sell through the IB API
(3) determine the optimal portfolio weights (e.g. equal weighting or higher weight based on ranking)
(4) buy the highest ranked new holdings and/or re-balance the portfolio using the portfolio weights of step (3) using the IB API

Interested in your thoughts.

Best,

Victor

That’s definitely feasible with the p123 and IBKR APIs.

But if you have any p123 subscription level, then you can also link at least 2 IBKR accounts, build a live strategy in p123 and allocate capital in your linked IBKR account to the live strategy. If the live strategy automatically rebalances, then it would only take you about 2 or 3 clicks once a week to have the generated trades submitted to your IBKR account.

You’d only need to go the p123/IBKR API route if you want to:
A) Completely automate trade submission
B) Support some kind of portfolio/trade logic not supported by p123.
C) Send an IBKR order type not currently supported by p123.

It doesn’t sound like B is the case as your portfolio logic is easily handled by p123.

Thank you feldy.

Indeed most of what I described is possible within the p123 framework like you mentioned. The only thing that I do not think is possible is a monthly rebalancing, hence my search for a workaround.

Best,

Victor

If you use the following command in both your buy and sell rules and use daily rebalancing, you’ll get effective monthly rebalancing, unless there’s a holiday on the first calendar day of the month. In the sell rules, you’ll need to add “AND” and the formula to every line.

MonthDay = 1 or (WeekDay = 2 and MonthDay = 2) or (WeekDay = 2 and MonthDay = 3)

We are planning to add the command MonthBars, which will make this easier to do and will work with holidays.