Hello all,
I just made my first algorithm, I used one I found here in the quantopian community, and modified it.
What it does :
1) Set universe
2) Every 30 days, I import history on 300 days, and calculate 9 months yield.
3) For each asset, if 9 months yield > 1.4, I set this asset in the buy_list as True, else False
4) Then I calculate the WEIGHT based on the number of values that are "True" (N_buy)
5) For each asset, I buy it with order_target_percent at WEIGHT if buy_list is True, else I sell it with order_target_percent at 0.
For some reason, I have a huge bug around march 2015 on my backtest, if I change the dates it seems to disappear, I really don't understand what is going wrong. From looking at the backtest, it seems that it start selling CAPR security several times a day several days in a row. Which should not happen since it should just target 0 percent and then do nothing.
Do you have any idea what is going on? I think I really need to understand this.
Thank-you all for your help !