Hello QuantConnect Community,

I am new member to Quant community. I am not from Computer science or finance background. I learnt some concepts and i want to write my first algorithm.

The algorithm is described below

Source: Book - The Alpha formula

Author : Connors Research Team

Strategy:

Universe: etfs = [
           # Equity
           'SPY',    # S&P 500
           'IWM',    # US Small cap
           'QQQ',   # NASDAQ
           'EFA', #Developed Ex US
           'EEM', #Emerging markets
           'VNQ', #US RealEstate
           'LQD', #US Inv. Grade Crops
           # Fixed incomet
           'GLD',    # Treasury Bond
           'SHY',    # High yield bond
           'IEF',    #
           'TLT',    #
           'AGG'
       ]

Rising Assets Strategy Rules
1. On the last business day of every month, invest in the top 5 assets with the highest
momentum score.
2. Sell any asset that was previously in the top 5 but has since dropped out.
3. Weight each asset by the inverse of its 63-day historical volatility.
Momentum Score
Our momentum score is the average of the last 1mo, 3mo, 6mo and 12mo trailing total
returns.
We opt for an unoptimized average of lookbacks. This is consistent with the method
Momentum Score Example:SPY 1 Month Return = +2.0%
SPY 3 Month Return = -4.0%
SPY 6 Month Return = +11.0%
SPY 12 Month Return = +8.0%
Average Return = (2% - 4% + 11% + 8%) / 4 = 4.25%
Result is a Momentum Score of 4.25%
Inverse Volatility Asset Weights
Asset weights are equivalent to the inverse of each asset’s trailing 3-month (63 trading
days) historical volatility. Volatility here is measured by the standard deviation of each
ETF’s daily returns.
This step serves to increase diversification in the portfolio as inverse weighting every
asset avoids one volatile asset from dominating the portfolio.
The typical effect of this step, compared to equal weighting the assets, is a slight decrease in
returns but a larger decrease in risk. This increases the return / risk metrics such as the
Sharpe Ratio.
Inverse Volatility Example:
SPY Std Dev = 0.10
EEM Std Dev = 0.20
Take 1 divided by each Std Dev observations and sum the results:
SPY 1 / 0.10 = 10
EEM 1 / 0.20 = 5
10 + 5 = 15
Divide each by the sum to get percent capital allocation:
SPY 10 / 15 = 0.666
EEM 5 / 15 = 0.333
Result is a 66.6% allocation to SPY and a 33.3% allocation to EEM
My doubts:

  1. Whats the period i should select for month, three, six month , 12 month i.e is it trading days or all days in months?
  2. How to calculate the volatality and asset allocaton ?