Overall Statistics
Total Trades
13
Average Win
0.26%
Average Loss
-0.14%
Compounding Annual Return
1.558%
Drawdown
0.600%
Expectancy
-0.178
Net Profit
0.658%
Sharpe Ratio
0.929
Probabilistic Sharpe Ratio
47.821%
Loss Rate
71%
Win Rate
29%
Profit-Loss Ratio
1.88
Alpha
0.013
Beta
-0
Annual Standard Deviation
0.014
Annual Variance
0
Information Ratio
-2.001
Tracking Error
0.127
Treynor Ratio
-97.549
Total Fees
$0.00
Estimated Strategy Capacity
$3400000.00
Lowest Capacity Asset
AUDUSD 8G
class MACrossover(QCAlgorithm):

    def Initialize(self):
        # Set Date Range (Frame 1)
        # self.SetStartDate(2016, 1, 1)
        # self.SetEndDate(2020, 12, 31)
        
        # Set Date Range (Frame 2)
        # self.SetStartDate(2011, 1, 1)
        # self.SetEndDate(2015, 12, 31)
        
        # Set Date Range (Frame 3)
        # self.SetStartDate(2006, 1, 1)
        # self.SetEndDate(2010, 12, 31)
        
        # Set Date Range (Frame 4)
        # self.SetStartDate(2001, 1, 1)
        # self.SetEndDate(2005, 12, 31)
        # self.SetCash(100000)  # Set Strategy Cash
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 6, 4)
        
        self.SetCash(6850)  # Set Strategy Cash
        
        self.long_list =[]
        self.short_list =[]
        
        self.stop =False
        
        self.currencies = ["EURUSD", "GBPUSD", "USDCHF", "AUDUSD", "USDCAD", "USDJPY"]
   
        self.AddForex("EURUSD", Resolution.Daily)   
        self.AddForex("GBPUSD", Resolution.Daily)   
        self.AddForex("USDCHF", Resolution.Daily)    
        self.AddForex("AUDUSD", Resolution.Daily)   
        self.AddForex("USDCAD", Resolution.Daily) 
        self.AddForex("USDJPY", Resolution.Daily) 
    
    def OnData(self, data):
        
        if self.stop:
            return
        
        currencies = self.currencies
        
        for currency in currencies:
            self.Debug(currency)
            currency_data = self.History ([currency], 40, Resolution.Daily)
            MA40_Pre = currency_data.close[0:40].mean()
            MA5_Pre = currency_data.close[35:40].mean()
            
            MA40_Current = currency_data.close[1:41].mean()
            MA5_Current = currency_data.close[36:41].mean()
            
            if currency not in self.long_list and currency not in self.short_list:
                print ("found currency" +str(currency))
                if MA5_Pre < MA40_Pre and MA5_Current > MA40_Current:
                    self.SetHoldings (currency, 0.1)
                    self.long_list.append(currency)
                    
                if MA5_Pre > MA40_Pre and MA5_Current < MA40_Current:
                    self.SetHoldings (currency, -0.1)
                    self.short_list.append(currency)
                    
            if currency in self.long_list:
                if MA5_Pre > MA40_Pre and MA5_Current < MA40_Current:
                    self.SetHoldings (currency, -0.1)
                    self.long_list.remove(currency)
                    self.short_list.append(currency)
                    
            if currency in self.short_list:
                 if MA5_Pre < MA40_Pre and MA5_Current > MA40_Current:
                    self.SetHoldings (currency, 0.1)
                    self.short_list.remove(currency)
                    self.long_list.append(currency)
                    
            # if self.Portfolio.Cash < 0.85*10000:
            if self.Portfolio.Cash < 0.85*6850:
                self.stop = True
                self.Liquidate()