Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
45.040%
Drawdown
10.000%
Expectancy
0
Net Profit
4.326%
Sharpe Ratio
1.652
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.827
Beta
62.691
Annual Standard Deviation
0.24
Annual Variance
0.057
Information Ratio
1.572
Tracking Error
0.239
Treynor Ratio
0.006
Total Fees
$30.42
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)