Overall Statistics
Total Trades
3
Average Win
3.21%
Average Loss
0%
Compounding Annual Return
1.249%
Drawdown
20.700%
Expectancy
0
Net Profit
2.625%
Sharpe Ratio
0.167
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.132
Beta
-5.634
Annual Standard Deviation
0.112
Annual Variance
0.013
Information Ratio
-0.012
Tracking Error
0.112
Treynor Ratio
-0.003
Total Fees
$58.52
import numpy as np
import datetime

class SellInMayBuyInNov(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2017,1, 1)  #Set Start Date
        self.SetEndDate(2019,2,1)    #Set End Date
        self.SetCash(1000000)           #Set Strategy Cash
        # Find more symbols here: http://quantconnect.com/data
        self.AddEquity("SPY", Resolution.Daily,Leverage=1,fillDataForward = True, extendedMarketHours = False)
        self.SetRunMode(RunMode.Series)
        

    def OnData(self, data):
        if self.Time.month == 5:
            if self.Portfolio.Invested:
                self.Liquidate()
                self.Debug("Sell In May " + str(self.Time.year))
        elif self.Time.month  == 11:
            if not self.Portfolio.Invested:
                self.SetHoldings("SPY", 1)
                self.Debug("Buy In Nov " + str(self.Time.year))