Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
import numpy as np
import datetime

class SellInMayBuyInNov(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2018,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.Minute,Leverage=4,fillDataForward = True, extendedMarketHours = False)
        self.SetRunMode(RunMode.Series)
        

    def OnData(self, data):
        if self.Time.month == 5:
            if self.Portfolio.Invested:
                self.SetHoldings("SPY", -Qty)
                self.Debug("Sell In May " + str(self.Time.year) +" Quantity:"+ str(Qty))
        elif self.Time.month  == 11:
            if not self.Portfolio.Invested:
                Qty= self.Portfolio.Cash/data["SPY"].Close
                self.SetHoldings("SPY", Qty)
                self.Debug("Buy In Nov " + str(self.Time.year) +" Quantity:"+str(Qty))