Pair slope/hedge uses linear regression to calculate the hedge ratio (slope) between the two assets within a period.
It allows you to specify a "from" and a "to" candle.
"A regression from 1000 candles back in time and ignore the last 100 candles. This would result in making a regression of 900 candles in total."
The formula used to perform the...
Revision 2 Considerations :
- Simplify and clean up plotting
Disclaimer: This strategy is currently working on the 5M chart. Change the length input to accommodate your needs.
For the backtesting of more than 3 months, you may need to upgrade your membership.
The general idea of the...
An old but gold Japanese indicator for Mean Reverting strategies and ideal for Pairs Trading...
The Kairi Relative Index measures the distance between closing prices and a Moving Average in percent value (generally SMA).
Extreme reading in the KRI are considered buy and sell signals.
Extreme readings will vary by asset, with more volatile assets reaching much...
Pairs trading using hedge ratio.
Firstly, it calculates hedge ration using OLS linear regression.
Then it calculates spread and z-score of spread.
if spread in specific range (which it's possible to change in settings) it makes Long/Short orders.
The very basic script.
A Simple Implementation of a Pairs Trading Strategy
It uses a simple moving average of specified length (default = 20) and enters at cutoffs set by Entry ZScore. Trades are exited at the moving average.
It is intended to be run on pairs of stocks. To Spread KO and PEP, for example, use the ticker KO / PEP * 1000
To visualise the trade better add Bollinger...