Stock Selection with Fundamental Data in QuantConnect
Learn how to filter and rank stocks using fundamental data like P/E ratio, market cap, and revenue in your QuantConnect universe selection model to build value or growth-based stra...
A curated index of all 118 SEO examples for quantconnect, built for quick discovery and comparison across quantitative trading scenarios.
Learn how to filter and rank stocks using fundamental data like P/E ratio, market cap, and revenue in your QuantConnect universe selection model to build value or growth-based stra...
Improve your algorithm development workflow with effective debugging strategies in QuantConnect. Learn how to use logging, charts, and backtesting tools to find and fix errors in y...
Learn the techniques for subscribing to and managing multiple data resolutions (e.g., daily, hourly, minute) within one algorithm to build more sophisticated trading models in Quan...
Explore advanced options trading by building an Iron Condor strategy in QuantConnect. This tutorial covers selecting strikes, managing the four-legged trade, and monitoring the pos...
Master futures trading in QuantConnect by learning how to use continuous future contracts for seamless backtesting across contract expirations, including data mapping and rollover ...
Learn to build a classic trend-following strategy using Donchian Channels. This guide shows how to identify price breakouts and place trades with the QuantConnect API.
Take full control of your portfolio's risk by creating a custom RiskManagementModel in the QuantConnect LEAN Framework. This tutorial guides you through the implementation pro
Move beyond fixed position sizes. Learn how to adjust your trade sizes based on market volatility using the Average True Range (ATR) indicator in your QuantConnect algorithm.
Discover how to use QuantConnect's ObjectStore API to save variables, data, or trained models between backtesting sessions and for live trading deployment.
Learn how to implement a classic mean reversion trading strategy using Python on the QuantConnect platform. This guide covers calculating moving averages and placing trades when pr...
Go beyond built-in models by learning to create your own custom Alpha Model within the QuantConnect Algorithm Framework. This tutorial covers the structure, methods, and implementa...
A detailed guide to creating a market-neutral pairs trading strategy in QuantConnect. Learn how to identify cointegrated pairs, calculate spreads, and execute trades based on stati...
Enhance your algorithm analysis by learning how to plot custom time series data, such as indicator values, portfolio metrics, or custom scores, on your QuantConnect backtest result...
Learn to generate income from your stock holdings by implementing a covered call strategy. This tutorial covers selecting options, placing trades, and managing positions in a Quant...
A comprehensive guide on integrating a pre-trained machine learning model from a library like Scikit-learn to generate trading signals within a QuantConnect algorithm. Includes a P...
Discover techniques for running parameter optimization on your QuantConnect algorithms to find the most robust settings for indicators and strategy logic, improving backtest perfor...
Learn how to protect profits and limit losses dynamically by implementing trailing stop loss orders in your QuantConnect trading strategies. Includes Python code examples and best ...
Explore how to implement a mean-reversion strategy based on the Relative Strength Index (RSI). This tutorial includes a full Python example for trading overbought and oversold sign...
This guide provides a step-by-step walkthrough and a complete Python code example for creating a classic MACD (Moving Average Convergence Divergence) crossover strategy on the Quan...
Learn how to import, manage, and utilize custom datasets, such as CSV files with sentiment scores or alternative data, within your QuantConnect trading algorithms to create more so...
Learn to precisely time your trading logic in QuantConnect by using `schedule.on` with `time_rules.after_market_open` to execute code a specific amount of time after the market ope...
Build more robust live trading algorithms by implementing the `on_brokerage_disconnect` and `on_brokerage_reconnect` event handlers to manage your strategy's state during conn...
Learn how to use the `add_forex` method in QuantConnect to subscribe to foreign exchange data streams like EURUSD, specifying resolution and market for your currency trading strate...
Enhance your risk management by learning how to implement a dynamic stop-loss order in QuantConnect that adjusts based on the Average True Range (ATR) of a security, adapting to ma...
Discover how to set a custom benchmark security, such as SPY, in your QuantConnect algorithm to accurately measure its performance against a relevant market index.
Learn how to access fundamental properties of a security object in QuantConnect, such as the current price, holdings information, and market data, using the `self.securities` colle...
A focused guide on migrating your QuantConnect Python algorithm to the new PEP8 API, specifically covering the change from CamelCase properties like `HoldingsValue` to snake_case `...
Learn the correct pattern for creating chained or conditional trades in QuantConnect by placing a new order inside the `on_order_event` handler, ensuring logic only runs after a pr...
Master QuantConnect's `Slice` object by learning how to correctly access different data types like `TradeBars` and `QuoteBars` within your `on_data` event handler for multi-as...
Learn the new PEP8 standards for enums and constants in QuantConnect, such as converting `Resolution.Minute` to `Resolution.MINUTE` and `OrderStatus.FILLED` to `OrderStatus.FILLED`...
Learn the key differences between synchronous order events in backtesting and asynchronous events in live trading. This guide provides best practices, such as avoiding placing new ...
Discover how to use Scheduled Events or the `train` method in QuantConnect to perform computationally intensive tasks like model training or data analysis before the market opens, ...
Understand how enabling fill-forward data ensures your `on_data` event handler is called regularly, even without new trade data. This guide explains the benefits and potential pitf...
Learn about QuantConnect's built-in mechanism that automatically submits market-on-open orders to liquidate equity option contracts when the underlying stock has an upcoming s...
This tutorial explains the cash settlement process within QuantConnect's backtesting engine. Learn when cash from trades becomes available and how to model settlement delays t...
Learn how QuantConnect's fill models simulate the execution of non-market orders like limit and stop orders in a backtest. Understand the assumptions and logic to improve the ...
Explore the critical differences in how data slices are processed between backtesting and live trading in QuantConnect, especially when your algorithm's `on_data` handler is s...
This guide explains how QuantConnect's engine uses CME SPAN margins for futures contracts. Learn how this realistic margin modeling impacts your futures trading strategies and...
Discover how to accurately model a Pattern Day Trader (PDT) account in your QuantConnect backtests. This tutorial covers setting up your algorithm to use 4x intraday equity margin ...
Learn how to select a specific past version of the LEAN engine in your QuantConnect projects. This guide explains how to delay migration to new APIs like PEP8 by pinning your algor...
A step-by-step guide on how to implement a multi-asset, multi-currency arbitrage strategy in QuantConnect. Learn to manage cash in different currencies and execute trades based on ...
Go beyond simple universe selection by learning how to implement a custom Python function that filters and ranks symbols based on your own logic, such as calculated alpha or moment...
Learn the simple and effective way to check if your algorithm currently holds a position in a specific security using the `security.invested` boolean property in QuantConnect, perf...
Learn how to properly use the on_order_event handler in QuantConnect by checking for specific order statuses like FILLED, CANCELED, or SUBMITTED to build robust and error-free orde...
A detailed guide on using the BrokerageModelSecurityInitializer in QuantConnect to ensure your algorithm's security properties, such as leverage and margin models, accurately ...
Explore an advanced technique in QuantConnect to generate insights while storing custom calculated values, like ATR, which can then be used in your on_order_event handler to set dy...
Learn how to use the InitialMarginParameters and get_initial_margin_requirement methods in QuantConnect to accurately calculate the initial margin needed for a trade before placing...
Step-by-step guide to creating a custom FixedFractionPortfolioConstructionModel in QuantConnect. Learn to control position size by allocating a fixed percentage of your portfolio t...
Discover a robust pattern for attaching stop-loss and take-profit orders in QuantConnect by using the on_order_event handler to trigger the orders immediately after your main entry...
Learn how to use the on_margin_call_warning event handler in QuantConnect to proactively manage your portfolio's leverage and avoid forced liquidations by responding when your...
Improve your portfolio management by learning how to automatically liquidate positions for securities that are removed from your dynamic universe. This guide shows how to use the `...
Learn the proper way to access data for a specific security within the `on_data` event handler. This tutorial explains how to use the `slice.get(symbol)` method to retrieve the lat...
Avoid common runtime errors in your trading algorithms by learning why and how to check if your technical indicators are fully warmed up. This guide explains the importance of the ...
Go beyond built-in indicators and learn how to manually calculate the Average True Range (ATR) for any security using historical data and the Pandas library in QuantConnect. This g...
Learn a powerful data manipulation technique for algorithmic trading. This tutorial shows how to use the Pandas `unstack()` method in QuantConnect to transform historical data from...
Are you seeing strange errors after migrating to the new PEP8 API? This guide explains common naming conflicts, such as `self.securities` vs `self.Securities`, and provides clear s...
Gain full control over your portfolio during a margin call. This advanced QuantConnect guide demonstrates how to intercept and modify the default liquidation orders within the `on_...
Enhance your live trading algorithms by learning how to handle and interpret data from the `on_brokerage_message` event handler in QuantConnect. This guide covers how to process br...
Discover how to create adaptive trading strategies in QuantConnect by implementing a dynamic lookback period for your technical indicators. This tutorial explains how to adjust ind...
Learn how to calculate the historical volatility of an asset in your QuantConnect algorithm using the NumPy library. This guide provides a step-by-step Python example for implement...
Learn the importance of setting a time zone in your QuantConnect algorithm using self.set_time_zone(). This guide explains how to correctly align your strategy's time with spe...
A practical tutorial on using the pandas .pct_change() method with historical data DataFrames in QuantConnect to easily calculate period-over-period returns for momentum and other ...
Explore the powerful Security object in QuantConnect, accessed via self.securities[symbol]. Learn how to retrieve price, volume, holdings, and other critical information for any as...
Learn how to access tick-by-tick or minute-level quote data (bid and ask prices) within the on_data event handler using the slice.quote_bars object, essential for strategies involv...
This guide explains how to use the PortfolioTarget.Percent object within a custom Portfolio Construction Model in QuantConnect to allocate a specific percentage of your total portf...
Explore how to use QuantConnect's scheduled events with time_rules.before_market_close() to execute logic, such as position squaring or signal calculation, a specific amount o...
Learn the correct way to access the current and historical values of technical indicators like Bollinger Bands in QuantConnect using the .current.value property and ensure your ind...
A step-by-step guide on using the self.portfolio[symbol].invested property in QuantConnect to verify if you currently hold a long or short position in a specific security before ma...
Discover how to use the self.set_account_currency() method in QuantConnect to accurately model trading accounts denominated in currencies other than USD, such as USDT, EUR, or JPY,...
Learn how to use QuantConnect's logging methods like self.log(), self.debug(), and self.error() to effectively debug your trading algorithms, track variable states, and monito...
Leverage the power of NumPy within your QuantConnect strategies. This guide shows how to use NumPy for advanced calculations like standard deviation (`np.std`) and mean (`np.mean`)...
Dive deep into QuantConnect's margin and leverage modeling. Learn how to access the `buying_power_model` for any security to programmatically calculate margin requirements bef...
Explore the role of the Execution Model in the QuantConnect Framework. This guide details how the `ImmediateExecutionModel` works to instantly convert portfolio targets into market...
Learn how to use the Alpha Framework to generate predictive signals. This guide explains how to create `Insight.Price` objects with `InsightDirection` (Up, Down, Flat) to power you...
Discover how to easily create and use common technical indicators like Bollinger Bands (`BB`), RSI, and EMA directly within your QuantConnect algorithm, and how to check if they ar...
Learn a powerful technique to transform the multi-indexed DataFrame from `self.history` into a clean, symbol-columnar format using pandas' `unstack` method for easier analysis
Go beyond basic scheduling. This tutorial demonstrates how to use `DateRules` (e.g., `month_start`) and `TimeRules` (e.g., `after_market_open`) to trigger logic at precise moments ...
Explore how to add and trade cryptocurrency futures contracts in your QuantConnect algorithms. This guide covers adding data, placing orders, and handling crypto-specific concepts.
Learn how to use the `set_brokerage_model` method in QuantConnect to accurately simulate the trading conditions, fees, and leverage of specific brokerages for more realistic backte...
Discover how to use the self.transactions manager in QuantConnect to retrieve detailed information about any order, including its status, quantity, and type, by using its unique ID...
A step-by-step tutorial on performing a simple linear regression using NumPy within your QuantConnect algorithm to calculate a security's alpha relative to a benchmark like th...
Learn the best practices for requesting historical data for a list of symbols using a single history call in QuantConnect and how to efficiently process the resulting multi-index P...
Understand the properties and usage of the SecurityChanges object, which is passed to the on_securities_changed event. Learn how to effectively iterate through added_securities and...
A practical guide to using the CashBook object in QuantConnect to access, monitor, and manage your cash balances for different currencies like USD, EUR, or USDT in your trading alg...
Explore the advanced FuncSecuritySeeder class in QuantConnect to properly initialize your security prices at the start of a backtest, ensuring your strategy's performance is r...
Learn how to accurately simulate a pre-existing portfolio in your QuantConnect backtests by using the portfolio.set_holdings method to define initial quantities and average prices ...
A step-by-step guide on how to use the BuyingPowerModel in QuantConnect to calculate the initial margin required for an order before you send it, helping you manage risk and avoid ...
Discover how to use the on_command event handler to send external data and commands to your live trading algorithm, enabling real-time interaction and control over your strategy.
Learn how to use the on_securities_changed event handler in QuantConnect to automatically react to assets being added or removed from your universe, including how to liquidate posi...
Understand the changes in the new QuantConnect PEP8 Python API. This guide provides examples and explains how to update your existing algorithms from CamelCase to snake_case for me...
A beginner-friendly guide to creating a Forex trading algorithm in QuantConnect. Learn how to add Forex pairs, handle different resolutions, and place trades in the currency market...
Learn how to access and utilize key portfolio properties in QuantConnect like total value, cash, holdings, and unrealized profit to make informed decisions and monitor your algorit...
Protect your capital and lock in profits by learning how to programmatically create StopMarketOrder and LimitOrder types for stop-loss and take-profit levels in your QuantConnect a...
Learn how to use set_security_initializer and FuncSecuritySeeder in QuantConnect to control the initial data, such as price, for securities in your algorithm, especially for assets...
This guide provides a complete walkthrough for building and backtesting a Bollinger Bands trading strategy using Python in the QuantConnect environment, from adding the indicator t...
Explore the differences between using the set_holdings method and placing individual buy/sell orders in QuantConnect for portfolio management. Understand the pros and cons to choos...
Learn how to effectively use the algorithm warm-up period and the on_warmup_finished event in QuantConnect to initialize indicators and models before trading begins, ensuring your ...
Discover how to use the on_delistings event handler in QuantConnect to gracefully manage positions in securities that are being delisted from the market and avoid errors in your al...
Learn how to use the on_symbol_changed_events handler in QuantConnect to seamlessly manage security ticker changes and prevent your long-term trading strategy from breaking due to ...
Discover how to use the on_end_of_algorithm event to run code after a backtest or live trading session concludes, ideal for saving results or performing final calculations.
Explore the self.history() method to retrieve historical market data for any security, resolution, or lookback period, essential for calculating indicators and performing analysis.
Learn the different methods for closing open positions in your algorithm, including liquidating a specific symbol or adjusting its portfolio target to zero.
A detailed breakdown of the sequence of operations LEAN performs in each time slice, from data updates and margin calls to event handler execution.
Learn how to properly manage options assignments in your strategy using the dedicated on_assignment_order_event handler to process resulting equity positions.
The Slice object is central to QuantConnect. This guide explains how to access different data types within the on_data event, including prices, quotes, and corporate actions.
Prepare your algorithm for live trading by implementing the on_brokerage_disconnect and on_brokerage_reconnect event handlers to manage your strategy's state during connectivi...
Learn to use the schedule.on() method to trigger functions at specific times, perfect for automating periodic tasks like portfolio rebalancing or data analysis.
Move beyond equal weighting and learn to build your own portfolio construction model, demonstrated with a fixed fractional model that allocates a set percentage per signal.
This guide shows how to implement a short-term momentum strategy on a universe of ETFs, using an ATR indicator to set dynamic stop-loss and take-profit levels.
Learn to code the Dynamic Breakout II strategy, which adjusts its lookback period based on market volatility, using Bollinger Bands and historical data.
A detailed walkthrough of creating a stock selection strategy based on the Capital Asset Pricing Model (CAPM) alpha, using historical data and linear regression.
Understand how to use the Cashbook to manage balances in different currencies, essential for trading Forex, international stocks, or crypto pairs.
Learn to use the on_margin_call and on_margin_call_warning events to proactively manage leverage and prevent forced liquidations in your trading strategy.
Master the on_order_event handler to monitor order submissions, fills, and cancellations, enabling you to build more complex, stateful trading logic.
Explore how to use the on_securities_changed event to dynamically manage your trading universe, adding and removing assets as they meet your criteria.
Learn how to use the on_splits and on_dividends event handlers in your Python algorithm to correctly manage corporate actions and maintain accurate performance tracking.
Discover how to implement a crypto arbitrage strategy by trading the price discrepancies between spot and futures markets. Includes a full Python example using the Bybit brokerage ...
A step-by-step guide to developing and backtesting a multi-asset portfolio strategy using Python, covering stocks, forex, and cryptocurrencies in a single algorithm.
EasyQuant All rights reserved