Learning QuantConnect - Part VI: Indicators & Candlestick Patterns (Python) ππ¨βπ
QuantConnect is a powerful open-source, cloud-based platform for algorithmic trading platform. It allows users to design, test, and deploy trading strategies across various financial markets including equities, FX, futures, options, and cryptocurrencies.
QuantConnect can be a bit of a beast when it comes to complexity. The thing is packed with features and, let's be real, wading through the docs can be a bit overwhelming. So in this series I tried to break it down into bite-sized chunks that won't make your head hurt. In this part we will take a look at how to use technical indicators, market breath indicators and candlestick patterns.
Suggested Reads:
Learning QuantConnect - Part II: Portfolio, Security Holding & Cashbook
Learning QuantConnect - Part IV: Working with Data and DataSets
This story is solely for general information purposes, and should not be relied upon for trading recommendations or financial advice. Source code and information is provided for educational purposes only, and should not be relied upon to make an investment decision. Please review my full cautionary guidance before continuing.
QuantConnect supports over 100 technical indicators and candlestick patterns. To demonstrate the use, Iβm going to pick a few popular indicators from each category.
For a full list of the supported technical indicators, check out the QuantConnect docs.
Momentum Indicators
Using the Relative Strength Index (RSI) with a single symbol
The Relative Strength Index (RSI) measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of a stock or other asset.
The RSI is configured using the RSI method of the QCAlgorithm along with the configuration parameters like symbol, RSI window, Moving Average Type and time resolution.
Before using the indicator, you can use the IsReady flag to check if the initialization period has passed.
Here an example how to use it:
class TestAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2024, 1, 1) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
# Subscribe to AAPL data
self.aapl = self.AddEquity("AAPL", Resolution.Daily)
self.aaplSymbol = self.aapl.Symbol
self.rsiAAPL = self.RSI(self.aaplSymbol, 14, MovingAverageType.Simple, Resolution.Daily);
def OnData(self, data):
# Make sure the RSI is initialized
if (not self.rsiAAPL.IsReady):
return
if self.rsiAAPL.Current.Value < 30:
self.Log(f"RSI Oversold condition")
elif self.rsiAAPL.Current.Value > 70:
self.Log(f"RSI Overbought condition")
Take the emotions out of trading and free up hours of screen time by letting the algorithms do the work for you. Join Algohive and get an exclusive 50% discount on our membership.