Overall Statistics
Total Orders
1369
Average Win
0.88%
Average Loss
-1.17%
Compounding Annual Return
4.876%
Drawdown
60.300%
Expectancy
0.139
Start Equity
100000
End Equity
289209.90
Net Profit
189.210%
Sharpe Ratio
0.16
Sortino Ratio
0.167
Probabilistic Sharpe Ratio
0.002%
Loss Rate
35%
Win Rate
65%
Profit-Loss Ratio
0.76
Alpha
-0.015
Beta
0.808
Annual Standard Deviation
0.174
Annual Variance
0.03
Information Ratio
-0.202
Tracking Error
0.122
Treynor Ratio
0.034
Total Fees
$9204.68
Estimated Strategy Capacity
$90000.00
Lowest Capacity Asset
ARGT UULB4CASSRXH
Portfolio Turnover
1.93%
#region imports
from AlgorithmImports import *
#endregion
# https://quantpedia.com/Screener/Details/15


class CountryEquityIndexesMomentumAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2002, 1, 1) 
        self.set_cash(100000) 
        # create a dictionary to store momentum percent indicators for all symbols 
        self._data = {}
        period = 6*21
        # choose ten sector ETFs
        symbols = ["EWJ",  # iShares MSCI Japan Index ETF
                   "EZU",  # iShares MSCI Eurozone ETF
                   "EFNL", # iShares MSCI Finland Capped Investable Market Index ETF
                   "EWW",  # iShares MSCI Mexico Inv. Mt. Idx
                   "ERUS", # iShares MSCI Russia ETF
                   "IVV",  # iShares S&P 500 Index
                   "ICOL", # Consumer Discretionary Select Sector SPDR Fund
                   "AAXJ", # iShares MSCI All Country Asia ex Japan Index ETF
                   "AUD",  # Australia Bond Index Fund
                   "EWQ",  # iShares MSCI France Index ETF
                   "BUND", # Pimco Germany Bond Index Fund
                   "EWH",  # iShares MSCI Hong Kong Index ETF
                   "EPI",  # WisdomTree India Earnings ETF
                   "EIDO"  # iShares MSCI Indonesia Investable Market Index ETF
                   "EWI",  # iShares MSCI Italy Index ETF
                   "GAF",  # SPDR S&P Emerging Middle East & Africa ETF
                   "ENZL", # iShares MSCI New Zealand Investable Market Index Fund
                   "NORW"  # Global X FTSE Norway 30 ETF
                   "EWY",  # iShares MSCI South Korea Index ETF
                   "EWP",  # iShares MSCI Spain Index ETF
                   "EWD",  # iShares MSCI Sweden Index ETF
                   "EWL",  # iShares MSCI Switzerland Index ETF
                   "GXC",  # SPDR S&P China ETF
                   "EWC",  # iShares MSCI Canada Index ETF
                   "EWZ",  # iShares MSCI Brazil Index ETF
                   "ARGT", # Global X FTSE Argentina 20 ETF
                   "AND",  # Global X FTSE Andean 40 ETF
                   "AIA",  # iShares S&P Asia 50 Index ETF
                   "EWO",  # iShares MSCI Austria Investable Mkt Index ETF
                   "EWK",  # iShares MSCI Belgium Investable Market Index ETF
                   "BRAQ", # Global X Brazil Consumer ETF
                   "ECH",  # iShares MSCI Chile Investable Market Index ETF
                   "CHIB", # Global X China Technology ETF
                   "EGPT", # Market Vectors Egypt Index ETF
                   "ADRU"] # BLDRS Europe 100 ADR Index ETF

        # warm up the MOMP indicator
        self.set_warm_up(period)
        for symbol in symbols:
            self.add_equity(symbol, Resolution.DAILY)
            self._data[symbol] = self.momp(symbol, period, Resolution.DAILY)
        # shcedule the function to fire at the month start 
        self.schedule.on(self.date_rules.month_start("IVV"), self.time_rules.after_market_open("IVV"), self._rebalance)

    def _rebalance(self):
        if self.is_warming_up: 
            return
        data = {k: v for k, v in self._data.items() if v.is_ready}
        top = pd.Series(data).sort_values(ascending=False)[:5]
        self.set_holdings([PortfolioTarget(symbol, 1/len(top)) for symbol in top.index], True)