Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-1.277%
Drawdown
36.300%
Expectancy
0
Net Profit
-10.384%
Sharpe Ratio
-0.036
Probabilistic Sharpe Ratio
0.013%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.021
Beta
0.211
Annual Standard Deviation
0.107
Annual Variance
0.012
Information Ratio
-0.534
Tracking Error
0.156
Treynor Ratio
-0.019
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
WIKI/IBM.NasdaqCustomColumns 2S
from AlgorithmImports import *

class NasdaqImporterAlgorithm(QCAlgorithm):

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
        self.nasdaqCode = "WIKI/IBM"
        ## Optional argument - personal token necessary for restricted dataset
        # NasdaqDataLink.SetAuthCode(self.GetParameter("nasdaq-data-link-api-key"))
        self.SetStartDate(2014,4,1)                                 #Set Start Date
        self.SetEndDate(datetime.today() - timedelta(1))            #Set End Date
        self.SetCash(25000)                                         #Set Strategy Cash
        self.AddData(NasdaqCustomColumns, self.nasdaqCode, Resolution.Daily, TimeZones.NewYork)
        self.sma = self.SMA(self.nasdaqCode, 14)

    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
        if not self.Portfolio.HoldStock:
            self.SetHoldings(self.nasdaqCode, 1)
            self.Debug("Purchased {0} >> {1}".format(self.nasdaqCode, self.Time))

        self.Plot(self.nasdaqCode, "PriceSMA", self.sma.Current.Value)

# NasdaqDataLink often doesn't use close columns so need to tell LEAN which is the "value" column.
class NasdaqCustomColumns(NasdaqDataLink):
    '''Custom nasdaq data type for setting customized value column name. Value column is used for the primary trading calculations and charting.'''
    def __init__(self):
        # Define ValueColumnName: cannot be None, Empty or non-existant column name
        
        super().__init__("adj. close")
        self.ValueColumnName = "adj. close"