Overall Statistics Total Trades10Average Win1.41%Average Loss0%Compounding Annual Return9.049%Drawdown2.300%Expectancy0Net Profit7.226%Sharpe Ratio2.132Loss Rate0%Win Rate100%Profit-Loss Ratio0Alpha0.031Beta2.814Annual Standard Deviation0.041Annual Variance0.002Information Ratio1.646Tracking Error0.041Treynor Ratio0.031Total Fees\$10.00
```### Simple RSI Strategy intended to provide a minimal algorithm example copied from BackTest Rookies
### one indicator attempting to use ADX and DM+ DM-
### </summary>
class RSIAlgorithm(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.'''

# Set our main strategy parameters
self.SetStartDate(2018,1, 1)   # Set Start Date
self.SetEndDate(2018,10,20)      # Set End Date
self.SetCash(10000)            # Set Strategy Cash

RSI_Period    = 14                # RSI Look back period
self.RSI_OB   = 60                # RSI Overbought level
self.RSI_OS   = 40                # RSI Oversold level
self.Allocate = 0.25              # Percentage of captital to allocate
self.TH       = 29                # threshold line for ADX
self.tcker    = "AAPL"

# Find more symbols here: http://quantconnect.com/data

self.RSI_Ind = self.RSI(self.tcker, RSI_Period)

# Ensure that the Indicator has enough data before trading,.
self.SetWarmUp(RSI_Period)

def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.

Arguments:
data: Slice object keyed by symbol containing the stock data
'''
self.close = data[self.tcker].Close
self.high = data[self.tcker].High
self.low = data[self.tcker].Low

self.Debug("{} Close: {} ADX: {} DIPLUS: {} DIMINUS: {}".format(self.tcker, self.close, self.adx, self.diplus, self.diminus))
# Check if we are in the market
if not self.Portfolio.Invested:
# If not, we check the RSI Indicator
if self.RSI_Ind.Current.Value < self.RSI_OS: # and self.diplus > self.TH: