
This graph is intended to be used in determining stationarity and cointegration between two price series. In trading based on the index, we will use it to identify points of divergence acceleration between the data series to generate entry and exit points.
In articles on pair trading, we discussed cointegration and stationarity in more detail. If you're interested, you can delve into it.
1. Graph of minimum residuals from the difference of two arrays of candlesticks with the optimal multiplier.
The calculation is as follows: Paper1 - (Paper2 * Multiplier). And we adjust the multiplier so that the standard deviation is minimal.
In interfaces for pair arbitrage, it looks like this:

Essentially, this is a simple indicator for two arrays of candlesticks. This graph allows for dynamically observing the deviation of one instrument from another and trading around its values. The two white bands on the graph are calculated as the standard deviation on the same graph, multiplied by another multiplier.
Since there are many ways to use the index in trading, it doesn't make sense to create a separate interface for each, so the indicator will have to be calculated within the source code, without visualization.
2. In arbitrage based on the index, we use a version of calculating this graph without visualization.
The placement of this indicator in OsEngine:

That's about it. Just a reminder about "Minimum residuals from the difference of two price series with the optimal multiplier" - it will be very useful in many aspects of trading based on the index. Different uses of this graph in trading logic can help us in tests and trading:
1. Single-leg convergence index arbitrage.
2. Single-leg divergence index arbitrage.
3. Trading the classic "Index arbitrage."
4. Trading speeding up securities based on the index in different directions in "trading spreads, accelerating securities from the index in one sector.
But we will discuss all of this in the following articles on the topic...
If you have any difficulties or questions, please write to the support chat. Link
OsEngine: https://github.com/AlexWan/OsEngine