- ago
Let's assume the simpliest strategy: buy all the components of an index and rebalance monthly to keep the same approximate allocation for all positions.

This requires buy/sell on the same bar.

I know I could drop to C# but right now this wolf has little no energy to learn new tricks....
0
156
Solved
5 Answers

Reply

Bookmark

Sort
- ago
#1
Please correct me if I'm wrong. My understanding is you're using a Rotation strategy on Monthly bar scale and notice that the exit is done at market on the first day of next month. In WL7 it's not possible to exit "this bar at close" in Blocks. Your system evaluates the criteria after the monthly close and issues an order to rebalance the next market open.
0
Cone7
- ago
#2
Let's create a new indicator: TradingsDaysLeftThisMonth(BarHistory bars, int idx), so that on the last trading day of the month the indicator is 0.

This would be useful to trigger trades AtClose on the last day of a month when TradingsDaysLeftThisMonth == 1 or on the first day of the next month when TradingsDaysLeftThisMonth == 0.

.. and then, it should be a simple matter to create the simplest rotation strategy case above.
3
- ago
#3
Good idea, I'd even call it TradingDaysLeft with a choice of period (week, month, quarter) through a dropdown parameter using ParameterTypes.StringChoice.
1
Best Answer
- ago
#4
Yes, thank you this is usefull as it solves the problem of the missing blocks to replace the end of month/quarter/year 6.9 rules.

But... back to my rotation strategy... at the end of the period, say week/month/quarter I get the new portfolio composition. So I have postions to sell, positions to buy and positions to rebalance, partial buy and sells. With 6.9 I gave up (no access to equity data) every period I would rebalance in excel and prepare an IB basket to submit at market.

To backtest (in 6.9) I sell all positions at the end of the period next bar at market and buy the new portfolio next bar at market using equal percentage amounts.

0
- ago
#5
I checked. Maybe I could use the rotation strategy built-in but I miss the following:

1) a threshold for the indicator to filter the permissible values
2) a limit to force the rebalancing of an existing position. Let's say the basic allocation is 33% and the position after a while becomes 30% or 36% of total equity. so it is brought back to 33%
0

Reply

Bookmark

Sort