Overall Statistics
import numpy as np
import pandas as pd



class ForexIndicator(QCAlgorithm):

    def Initialize(self):
        
        self.SetStartDate(2018,2,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)
        IndicatorPlot = Chart("Trade Plot")
        
        
        self.AddEquity("SPY", Resolution.Minute)
        
        # Schedule the rebalance function (Once everyday at Market open)
        self.Schedule.On(self.DateRules.EveryDay("SPY"), 
        self.TimeRules.AfterMarketOpen("SPY", 0), 
        Action(self.rebalance))
        
    def OnData(self,data):
        pass
    
    def rebalance(self):
        
        price = self.Securities['AAPL'].Price
        if price <= 0: return
        self.Plot("Trade Plot", "Price", price)
        
        if not self.Securities["AAPL"].Invested:
            
            self.SetHoldings("AAPL", 1.0)