

Metaphorically speaking, cointegration is like a couple in a clingy relationship where two parties are crazy-glued together. The core idea of pair trading is cointegration. The simple rule is we always long the cheap stock and short the expensive stock. When the standardized residual exceeds the threshold, it generates the trading signal. After that, we compute the current standardized residual of the selected stocks accordingly. Once the criteria of cointegration is met, we standardize the residual and set one sigma away (two tailed) as the threshold. First step, we select two stocks and run Engle-Granger two step analysis. It relies on the assumption that two cointegrated stocks would not drift too far away from each other. Pair trading is the basic form of statistics arbitrage. Vice versa.Ĭlick here to be redirected to the script. When short term moving average is above long term moving average, we long the given stock accordingly. To generate the trading signal, we implement a comparison between the moving averages of different time horizons. Therefore, we should not underestimate the power of MACD oscillator.įor the strategy itself, we compute long term moving average and short term moving average on the close price of a given stock. In behavioral economics, the more people believe in the strategy, the more effective the strategy becomes (not always true, e.g. Regarding the simplicity of MACD oscillator, it is the most common strategy among the non-professionals in the market. It only takes 5 minutes for any bloke with no background in finance to trade with MACD signals. It is a momentum trading strategy which holds the belief that upward/downward momentum has more impact on short term moving average than long term moving average. MACD refers to Moving Average Convergence/Divergence. Yahoo Finance/ fix_yahoo_finance package/ yfinance package Relative Strength Index Pattern Recognition Last but not least, all scripts contain a global function named main so that you can embed the scripts directly into you trading system (although too lazy to write docstring). No slippage, no surcharge, no illiquidity. The assumption is that all trades are frictionless. Additionally, please note that, all scripts are historical data backtesting/forward testing (basically via Python, not C++, maybe Julia in the near future). There is no HFT strategy simply because ultra high frequency data are very expensive to acquire (even consider platforms like Quantopian or Quandl). These projects are mostly quantamental analysis on some strange ideas I come up with to beat the market (or so I thought). Hence, there are a few ongoing projects inside this repository. It can refer to computational finance to exploit derivative price mismatch, pattern recognition on alternative datasets to generate alphas or low latency order execution in the market microstructure. Yet, quantitative trading is not only about technical analysis.

These scripts include various types of momentum trading, opening range breakout, reversal of support & resistance and statistical arbitrage strategies. Most scripts inside this repository are technical indicator automated trading.

Elwyn Berlekamp, co-Founder of Combinatorial Game Theory The quotes above come from a book by Gregory Zuckerman, a book every quant must read, THE MAN WHO SOLVED THE MARKET. If you trade a lot, you only need to be right 51 percent of the time, we need a smaller edge on each trade. Robert Mercer, co-CEO of Renaissance Technologies but we’re 100 percent right 50.75 percent of the time, you can make billions that way.
