You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say i want to build a trend strategy with a universe of 10 stocks. Id like the strategy to invest up to 10% of the total portfolio value when any stock is trending up. Say stock A goes up, and i end up buying 100 shares. When stock B goes up, I want to invest up to 10% of the current portfolio value (which is hopefully higher since we invested in stock A because it was going up). But I don't want to change anything about stock A's position. We should keep the 100 shares of stock A no matter what percentage of the portfolio they amount to until the strategy decides to sell stock A.
Can bt backtest a strategy like this?
The text was updated successfully, but these errors were encountered:
@brettelliot Did you ever find a solution for this? I'm stuck with the exact same problem.
I don't want the algo to rebalance with every transaction made and just keep the existing positions as they are
Looking at the docs I see that the SecurityBase class has methods for allocate() and transact(), which are meant to buy/sell for a specific amount/quantity. I think we would just have to create a custom algo for buying/selling with these methods instead of using rebalance.
There's also the StrategyBase class which also has methods for allocate() and transact(). These seem to behave a little differently.
Hi,
Let's say i want to build a trend strategy with a universe of 10 stocks. Id like the strategy to invest up to 10% of the total portfolio value when any stock is trending up. Say stock A goes up, and i end up buying 100 shares. When stock B goes up, I want to invest up to 10% of the current portfolio value (which is hopefully higher since we invested in stock A because it was going up). But I don't want to change anything about stock A's position. We should keep the 100 shares of stock A no matter what percentage of the portfolio they amount to until the strategy decides to sell stock A.
Can bt backtest a strategy like this?
The text was updated successfully, but these errors were encountered: