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
import decimal as d
import json
class BasicTemplateAlgorithm(QCAlgorithm):

    def Initialize(self):
        '''Initialise the data and resolution required'''

        self.SetStartDate(2018,10,1)  #Set Start Date
        self.SetEndDate(2019,1,31)    #Set End Date
        #self.SetWarmUp(timedelta(50)) # set warmup in days
        self.SetCash(100000)           #Set Strategy Cash
        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage) #optional
        self.SetBenchmark('SPY')

        sym = 'SPY'
        self.AddEquity(sym, Resolution.Minute)
        self.myRSI = self.RSI(sym, 14, Resolution.Daily)


        # Schedule trades
        self.Schedule.On(self.DateRules.EveryDay('SPY'), \
                 self.TimeRules.BeforeMarketClose('SPY', 12), \
                 Action(self.Trade))


        self.Log("end init")
    
    #def OnData(self, data):
    #    self.Log("OD: "+ str(self.Time)+" : "+str(self.myRSI.Current.Value))

    def Trade(self):
        prc = self.Securities['SPY'].Price
        self.Log("PM: "+ str(self.Time)+" : "+str(prc)+" : "+str(self.myRSI.Current.Value))

    def OnEndOfDay(self):
        prc = self.Securities['SPY'].Price
        self.Log("EOD: "+ str(self.Time)+" : "+str(prc)+" : "+ str(self.myRSI.Current.Value))