Overall Statistics
import numpy as np
import pandas as pd



class ForexIndicator(QCAlgorithm):

    def Initialize(self):
        
        self.SetStartDate(2018,3,13)
        # If you don't set the end dates, you will get the latest date
        #self.SetEndDate(2018,1,20)
        self.SetCash(1000000)
        
        self.aapl = self.AddEquity("AAPL", Resolution.Minute).Symbol
        IndicatorPlot = Chart("Trade Plot")
        
        
        self.AddEquity("SPY", Resolution.Minute)
        
        # Schedule the rebalance function (Once everyday at 09:35am)
        self.Schedule.On(self.DateRules.EveryDay("SPY"), 
        self.TimeRules.AfterMarketOpen("SPY", 5), 
        Action(self.rebalance))
        
    def OnData(self,data):
        pass
    
    def rebalance(self):
        
        aapl_history = self.History(self.aapl, 5, Resolution.Daily)
        aapl_close = aapl_history['close'].unstack(level=0)
        self.Log('\n'+"AAPL Daily Price:  " + str(aapl_close))
        
        price = self.Securities['AAPL'].Price
        self.Log("AAPL Price:  " + str(price))
        
        if price <= 0: return
        self.Plot("Trade Plot", "Price", price)