- Joined
- 15 February 2017
- Posts
- 9
- Reactions
- 0
I have a nice monthly trading system which backtests well over 20 years I've live traded for one year. Now I am interested to see the effect of rebalancing once a year, probably at the end of May or December.
I am trying to find or write my own rebalancing code. I've got pretty vanilla requirements and I'd love to know if anyone has code to do this.
Strategy conditions:
1. If Position size is more than 5% greater than equal weight, then scale down to equal weight.
2. If Position size is more than 5% less than equal weight, then scale up to equal weight.
3. Limit rebalancing to once a year. Allow to optimize for best month of year.
4. Do not rebalance a position until it has been held for 12 months or longer.
I have found some examples but I'm struggling with them.
This example is rotational and quite frankly confuses me. Mine is not rotational.
http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions/
Example 3 here is closer but it is a fixed 5%, not a relative 5%.
https://www.amibroker.com/guide/h_pyramid.html
Generally, I don't understand how my existing position size (equal weighting) and my buy and sell rules are supposed to not conflict with the ScaleTrade ones.
Hopefully this thread results in a nice function that others in my situation can bolt onto their strategies.
I am trying to find or write my own rebalancing code. I've got pretty vanilla requirements and I'd love to know if anyone has code to do this.
Strategy conditions:
1. If Position size is more than 5% greater than equal weight, then scale down to equal weight.
2. If Position size is more than 5% less than equal weight, then scale up to equal weight.
3. Limit rebalancing to once a year. Allow to optimize for best month of year.
4. Do not rebalance a position until it has been held for 12 months or longer.
I have found some examples but I'm struggling with them.
This example is rotational and quite frankly confuses me. Mine is not rotational.
http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions/
Example 3 here is closer but it is a fixed 5%, not a relative 5%.
https://www.amibroker.com/guide/h_pyramid.html
Generally, I don't understand how my existing position size (equal weighting) and my buy and sell rules are supposed to not conflict with the ScaleTrade ones.
Hopefully this thread results in a nice function that others in my situation can bolt onto their strategies.