Introduction This tutorial provides basic introduction to Python language. If you are new to python, we suggest that you should read through this tutorial and run the code snippets so that you can go through to our following topics. If you are an advanced python user, please feel free to skip this chapter. Basic Variable Type […]

In this tutorial we build a strategy combining momentum and mean reversion for the foreign exchange markets from Alina F. Serban’s research. Serban creates a momentum factor using returns of the last 3 months, and a mean reversion factor as a deviation from the mean price. Using these factors we use regression to predict the returns of the coming month. We apply the strategy from Serban’s paper and update the mean reversion factor for to improve its significance level. In theory when trading foreign exchange the expected return accrued in each currency should be the same when adjusted for exchange rates (uncovered interest parity, UIP). This suggests the markets should predominately be mean reverting, however in practice we see short term momentum trends and long term mean reversion.

Abstract We investigate two pairs trading methods and compare the results. Pairs trading involves in investigating the dependence structure between two highly correlated assets. With the assumption that mean reversion will occur, long or short positions are entered in the opposite direction when there is a price divergence. Typically the asset price distribution is modeled by […]

In this tutorial we use regression to predict the return from the stock market and compare it to the short-term U.S. T-bill rate. It is based on the paper “Striking Oil: Another Puzzle?” by Gerben, Ben and Benjamin (2007).

The dual thrust trading algorithm is a famous strategy developed by Michael Chalek. It has been commonly used in futures, forex and equity markets. The idea of dual thrust is similar to a typical breakout system, however dual thrust uses the historical price to construct update the look back period – theoretically making it more stable in any given period.

In this tutorial we will take a close look at the Dynamic Breakout II strategy based on the book Building Winning Trading Systems by George Pruitt. Dynamic Breakout II is an auto adaptive trading system that can adjust its buy and sell rules depending on the performance of these rules in the past. It is widely used in forex, future and equity markets. You can refer to the video link to learn more about dynamic break out II.

This tutorial performs a simple linear regression to build Capital Asset Pricing Model(CAPM), a classical model developed by William F. Sharpe and Harry Markowitz. This model yields alpha and beta for each asset and is traded by going long the stocks ranked with the highest alpha. This tutorial demonstrates how to use historical data, set an event handler, conduct linear regression and build your own functions in the QuantConnect Algorithm Lab. The implementation of the strategy demonstrates that stocks beat the market last month are likely to beat again in the subsequent month. This algorithm performs well when the market is smooth. However when the market volatility increases the model fails to capture alpha and it performs poorly. We conclude market fluctuations decrease the significance level of the linear regression coefficients, especially when we are using daily returns to fit the model.

With a few configuration changes you can get desktop charting in LEAN with a HTML5 interface very similar to the one you see in QuantConnect.com. This gives you better visual feedback on your strategy and allows you to improve faster. This tutorial guides you through configuring a desktop charting environment with LEAN. Local charting (and […]

Scheduled events allow you to trigger code blocks for execution at specific times according to rules you set. This feature helps coordinate your algorithm activities and perform analysis at regular intervals; while letting the trading engine take care of market holidays. The scheduling is set with two rules: the DateRules and TimeRules classes. The schedule […]

Consolidators are used to combine data together from finer resolutions into larger ones. This can be useful for indicators with specific data requirements or to perform long term analysis in conjunction with short term signals. Consolidators should be constructed and setup in your Initialize() method; this ensures they are only initialized once. There are three […]

API
ApiDataProvider
api tutorials
automation
breakout
call
capm
cfd
charting
consolidators
csharp
dataframe
desktop charting
dow-30
dual thrust
equity
EURUSD
forex
free data
lean
managing orders
mean-variance analysis
Mean Reversion
modern portfolio theory
momentum
multi-factor model
NumPy
oil
open source
options
pandas
put
python
rate of return
regression
scheduled events
statistics
strategy tutorial
timing
tradebars
trades
uncovered interest parity
using data
ux
volatility