Statistical Arbitrage: Difference between revisions

From SharpTrader Arbitrage Software Wiki: A Detailed Overview of High-Speed Trading Technology
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
===== Statistical Arbitrage description =====
'''Statistical Arbitrage Strategy''' relies on the historically strong correlation between two financial instruments, for example, WTI and Brent, DE30 and F40, Amazon and Apple. Users can set a period for correlation determination, timeframe, and strong correlation level. The software sells strong and buys weak instruments when their correlation diverges beyond a certain level. Once mean reversion occurs, the locked position created by the two orders: buy and sell, should generally be in profit. This strategy is also known as convergence or pair trading.
Statistical arbitrage, or Stat Arb, is a quantitative investment strategy that aims to profit from pricing inefficiencies between related securities. These inefficiencies often emerge from the statistical mispricing of one or more assets about the underlying “true” value of these assets, which can be estimated using statistical models.


The strategy involves the simultaneous buying and selling of a portfolio of securities. A common approach is pairs trading, where two securities historically moving in tandem become misaligned. When one security is relatively overvalued, and the other is undervalued, the trader short-sells the overvalued security and buys the undervalued one. The expectation is that the prices will converge again in the future, yielding a profit.
'''THE CORE PRINCIPLE'''


Statistical arbitrage relies heavily on complex mathematical models, high-speed computers, and data analysis tools to identify and exploit trading opportunities. The strategy also assumes that the prices will return to a historical or predicted normal, a process known as mean reversion.
Statistical arbitrage relies on mean reversion principles and the law of large numbers. The underlying belief is that the relative prices of financial instruments that are historically correlated will revert to their mean over time. This is where statistical arbitrage occurs – it capitalizes on price discrepancies between these correlated instruments when they deviate from their historical norm.


Although statistical arbitrage aims to maintain a market-neutral position (thus minimizing exposure to systematic risk), it is not risk-free. Some risks associated with this strategy include model risk, liquidity risk, and execution risk. Also, because many statistical arbitrage strategies involve high-frequency trading, they can be sensitive to transaction costs.
For instance, consider two stocks that have moved together historically. If their prices diverge – one increases in price, and the other decreases – a statistical arbitrageur would sell short the outperforming stock and buy the underperforming one, betting that the “spread” between the two would eventually converge.


As of my knowledge cutoff in September 2021, statistical arbitrage is primarily used by hedge funds and other institutional investors. For most individual investors, the technical requirements for implementing this strategy are prohibitive. [https://bjftradinggroup.com/understanding-statistical-arbitrage-a-path-to-profitable-trading/ Learn more...]
'''SPREAD – TO THE PRICE DIFFERENCE OR DISCREPANCY BETWEEN TWO RELATED FINANCIAL INSTRUMENTS.'''


===== Statistical arbitrage instruments & Orders =====
In statistical arbitrage, the term ‘spread’ typically refers to the price difference or discrepancy between two related financial instruments. These could be two different stocks, futures contracts, forex pairs, or even cryptocurrency tokens.
[[File:Statistical.png|frameless|1180x1180px]]


'''Enabled''' - controls if the instrument is allowed to trade or not.
For example, one might track the spread between two historically co-integrated stocks in a pair trading strategy (a common form of statistical arbitrage). When the spread, or the difference in their prices, deviates significantly from its historical mean (average), it signals an opportunity to trade.


'''Symbol 1, Symbol 2''' – instrument names.
Suppose the spread widens too much, indicating one stock is overpriced and the other is underpriced relative to their historical relationship. In that case, a trader may sell short the overpriced stock and buy the underpriced one. Conversely, if the spread narrows excessively, they would do the opposite.


'''Lot size 1, Lot size 2''' – lot size to be traded.
The spread is expected to be mean-reverting in statistical arbitrage, meaning it fluctuates around a long-term average value. Traders expect that when the spread deviates significantly from this mean, it will eventually return to it, allowing them to profit from this reversion.
[[File:Sl.png|center|frameless|927x927px]]
In the SharpTrader platform Spread Indicator is used to visualize the correlation between two assets. The calculation of the correlation involves the following components:


'''Digits''' – how much digits instrument has in decimals.
* Spread: This refers to the numerical difference or distance between the values of two assets.
* SpreadMA: It represents the moving average of the spread over a specific period, determined by pi_SpreadMA_Period.
* STD (Standard Deviation): It calculates the classic standard deviation of the spread relative to SpreadMA. The number of observations used is equal to pi_SpreadMA_Period.


'''S/L''' – hidden stop loss for the position.
To trigger the opening of trades, the software follows the principles of statistical arbitrage theory.
[[File:Sl2.png|center|frameless|469x469px]]


'''T/P''' – hidden take profit for the position.
=== '''STATISTICAL ARBITRAGE – CORRELATION MATRIX''' ===
A correlation table, also known as a correlation matrix, is a table that shows the correlation coefficients between many variables. Each cell in the table shows the correlation between two variables. The value is in the range of -1 to 1.


'''Min profit''' – how much profit the order should get (in points) for system to start trailing on this position.
If two variables have a correlation of 1, they move in the same direction, i.e., when one increases, the other increases, and vice versa. This is known as a perfect positive correlation.


'''Trailing distance''' – the distance (in points) that is used for trailing on position.
If two variables correlate -1, they move in opposite directions, i.e., when one variable increases, the other decreases, and vice versa. This is known as a perfect negative correlation. A correlation of 0 means that no relationship exists between the variables.


'''Trailing units''' - Currency / Present . The software can calculate trailing stop in account currency or like percent from instrument's price.
Here’s a simple example of a correlation table for three variables: A, B, and C:
[[File:Sl3.png|center|frameless|515x515px]]


'''Order lifetime''' – the maximum time the position can be opened.


Strong correlation - correlation between instruments at which or at a higher the software can open a deal.
In this table, the correlation between variables A and B is 0.5 (a moderate positive correlation), while the correlation between A and C is -0.7 (a strong negative correlation). The diagonal of the matrix from the top left to the bottom right is always 1 because a variable is perfectly correlated with itself.


'''Max Spread slow 1, Max Spread slow 2''' - maximal allowed spread for the particular symbol.
These tables are widely used in various fields, including finance, where they help in determining the relationship between different financial variables or the returns of different assets, useful for portfolio diversification and risk management.
 
'''Comment''' - internal identifier. The comment should be different for similar instruments.
 
'''Correlation period''' - the number of bars for correlation calculation.
 
'''MA period''' - moving average period.
 
'''Spread STD''' - standard deviation. The standard deviation is always positive or zero. The standard deviation is small when the data are all concentrated close to the mean, exhibiting little variation or spread. The standard deviation is larger when the data values are more spread out from the mean, exhibiting more variation.
 
'''Curr corr -''' current correlation between 2 instruments.
 
'''Min corr''' - minimal correlation between instruments that was detected during software was running.
 
'''Max corr''' - maximal correlation between instruments that was detected during software was running.
 
'''Curr Spread Slow 1, Curr Spread Slow 2''' – current spread for instrument 1 and instrument 2.
 
 
==== Right mouse menu ====
'''Columns''' - show or hide columns from the grid.
 
'''Clear Max diff''' - clear maximal correlation between instruments that was detected during software was running
 
'''Add pair''' - add pair of instruments for the statistical arbitrage trading
 
'''Remove pair''' -remove the select pair of instruments from the grid
 
'''Save instrument settings''' - save selected instruments settings
 
'''Open lock on the selected instrument''' - open the lock on the selected instruments manually
 
'''Close lock on the selected instrument''' - close the lock on the selected instruments manually
 
'''Charts''' - open charts menu
 
'''Symbol 1, Symbol 2''' - show chart for symbol 1/ symbol 2.
 
'''Indicators''' - show correlation indicator for the selected instruments.
 
'''OHLC history''' - open OHLC (open, high low, close) history menu.
 
'''Load from file''' - load the history for the selected instruments from the file.
 
'''Load from server''' - load the history for the selected instruments from the BJF Trading Group history server.
 
'''Clean''' - Clean all historical data for the selected instruments

Revision as of 18:15, 4 September 2023

Statistical Arbitrage Strategy relies on the historically strong correlation between two financial instruments, for example, WTI and Brent, DE30 and F40, Amazon and Apple. Users can set a period for correlation determination, timeframe, and strong correlation level. The software sells strong and buys weak instruments when their correlation diverges beyond a certain level. Once mean reversion occurs, the locked position created by the two orders: buy and sell, should generally be in profit. This strategy is also known as convergence or pair trading.

THE CORE PRINCIPLE

Statistical arbitrage relies on mean reversion principles and the law of large numbers. The underlying belief is that the relative prices of financial instruments that are historically correlated will revert to their mean over time. This is where statistical arbitrage occurs – it capitalizes on price discrepancies between these correlated instruments when they deviate from their historical norm.

For instance, consider two stocks that have moved together historically. If their prices diverge – one increases in price, and the other decreases – a statistical arbitrageur would sell short the outperforming stock and buy the underperforming one, betting that the “spread” between the two would eventually converge.

SPREAD – TO THE PRICE DIFFERENCE OR DISCREPANCY BETWEEN TWO RELATED FINANCIAL INSTRUMENTS.

In statistical arbitrage, the term ‘spread’ typically refers to the price difference or discrepancy between two related financial instruments. These could be two different stocks, futures contracts, forex pairs, or even cryptocurrency tokens.

For example, one might track the spread between two historically co-integrated stocks in a pair trading strategy (a common form of statistical arbitrage). When the spread, or the difference in their prices, deviates significantly from its historical mean (average), it signals an opportunity to trade.

Suppose the spread widens too much, indicating one stock is overpriced and the other is underpriced relative to their historical relationship. In that case, a trader may sell short the overpriced stock and buy the underpriced one. Conversely, if the spread narrows excessively, they would do the opposite.

The spread is expected to be mean-reverting in statistical arbitrage, meaning it fluctuates around a long-term average value. Traders expect that when the spread deviates significantly from this mean, it will eventually return to it, allowing them to profit from this reversion.

In the SharpTrader platform Spread Indicator is used to visualize the correlation between two assets. The calculation of the correlation involves the following components:

  • Spread: This refers to the numerical difference or distance between the values of two assets.
  • SpreadMA: It represents the moving average of the spread over a specific period, determined by pi_SpreadMA_Period.
  • STD (Standard Deviation): It calculates the classic standard deviation of the spread relative to SpreadMA. The number of observations used is equal to pi_SpreadMA_Period.

To trigger the opening of trades, the software follows the principles of statistical arbitrage theory.

STATISTICAL ARBITRAGE – CORRELATION MATRIX

A correlation table, also known as a correlation matrix, is a table that shows the correlation coefficients between many variables. Each cell in the table shows the correlation between two variables. The value is in the range of -1 to 1.

If two variables have a correlation of 1, they move in the same direction, i.e., when one increases, the other increases, and vice versa. This is known as a perfect positive correlation.

If two variables correlate -1, they move in opposite directions, i.e., when one variable increases, the other decreases, and vice versa. This is known as a perfect negative correlation. A correlation of 0 means that no relationship exists between the variables.

Here’s a simple example of a correlation table for three variables: A, B, and C:


In this table, the correlation between variables A and B is 0.5 (a moderate positive correlation), while the correlation between A and C is -0.7 (a strong negative correlation). The diagonal of the matrix from the top left to the bottom right is always 1 because a variable is perfectly correlated with itself.

These tables are widely used in various fields, including finance, where they help in determining the relationship between different financial variables or the returns of different assets, useful for portfolio diversification and risk management.