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 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)