INVITE-ONLY SCRIPT
RunRox - Pairs Strategy

🧬 Pairs Strategy is a new indicator by RunRox included in our premium subscription.
It is a specialized tool for trading pairs, built around working with two correlated instruments at the same time.
The indicator is designed specifically for pair trading logic: it helps track the relationship between two assets, identify statistical deviations, and generate signals for opening and managing long/short combinations on both legs of the pair.
Below in this description I will go through the core functions of the indicator and the main concepts behind the strategy so you can clearly understand how to apply it in your trading.
📌 CONCEPT
The core idea of pair trading is to find and trade correlated instruments that usually move in a similar way.
When these two assets temporarily diverge from each other, a trading opportunity appears.

In such moments, the relatively overvalued asset is sold (short leg), and the relatively undervalued asset is bought (long leg).
When the spread between them narrows and both instruments revert back toward their typical relationship (mean), the position is closed and the trader captures the profit from this convergence.

In practice, one leg of the pair can end up in a loss while the other generates a larger profit.
Due to the difference in performance between the two assets, the combined result of the pair trade can still be positive.
✅ KEY FEATURES:
🔗 SCORE
Score is the core deviation metric between the two assets in the pair.
For example, if you are trading ETHUSDT/BTCUSDT, the indicator analyzes the relationship ETH/BTC, and when one leg temporarily diverges from the other, this difference is reflected in the Score value.
In other words, Score shows how much the current spread between the two instruments deviates from its typical state and is used as the main signal source for pair entries and exits.

In the screenshot above you can see how Score looks in our indicator.
Depending on how large the difference is between the two assets, the Score value can move in a range from −N to +N
Inside the indicator we added two different formulas for calculating the spread between the two legs of the pair: Z-Score and S-Score.
These approaches measure deviation in different ways and can produce slightly different signals depending on the chosen pair and its behavior.
This allows you to switch between Z-Score and S-Score and choose the method that gives more stable and cleaner signals for your specific instruments.
As you can see in the screenshot above, we used the same pair but applied different Score types to measure the spread and deviation from the norm.
⁉️ HOW DOES THE STRATEGY WORK
Here is a basic example of how you can trade this pair trading strategy using our indicator and its signals.
In the classic approach the trade consists of one initial entry and several scale-ins (averaging) if the spread continues to move against the position.
After that the position waits until Score returns back to the 0 level, where the whole pair position is closed.
This is the standard model of classical pair trading.
However there are many variations:
We designed the indicator to cover as many of these variations as possible and added flexible tools so you can build your own pair trading logic on top of it.

Below is an example of a classic pair trade with two entries: one main entry and one extra entry (scale-in).
The pair SUIUSDT / PENGUUSDT shows a high correlation, and on one of the trades the sequence looked like this:
A −2 Score deviation occurred into the long zone and triggered the Main Entry.
🔹 Main Entry
🔸 Extra Entry
❎ Exit
On different assets the size and speed of the spread movement will vary, but the principle remains the same.
This is just one example to illustrate how the strategy works in practice using simplified theoretical balances.
⚙️ MAIN SETTINGS
After explaining how the strategy works, we can move to the indicator settings and their logic.
The first block is Main Settings, which controls how the pair is built, how the spread is calculated, and how the backtest is performed.

The core idea of the indicator is to backtest historical data, generate entry signals, show open-position parameters, and provide all necessary metrics for both discretionary and algorithmic trading.
This is a complete framework for analyzing a pair of assets and building a trading system around them. Below I will go through the main parameters one by one.
🔹 Exclude Dates
Allows you to exclude abnormal periods in the pair’s history to remove outlier trades from the backtest.
This is useful when the market experienced extreme news events, listing spikes, or other non-typical situations that distort statistics.
🔹 Pair
Here you select the second asset for your pair.
For example, if your main chart is BTCUSDT, in this field you choose a correlated asset such as ETHUSDT, and the working pair becomes BTCUSDT / ETHUSDT.
The indicator then calculates spread, Score, and all related metrics based on this asset combination.
🔹 Lower Timeframe
This is a special mode for backtesting on a lower timeframe while using a higher timeframe chart to extend the history limit.
For example, if your TradingView plan provides only 5,000 bars of history on the current timeframe, you can switch your chart to a higher timeframe and select a lower timeframe in this setting.
The indicator will then reconstruct the pair logic using up to 99,000 bars of lower timeframe data for backtesting.
This allows you to test the pair on a much longer historical period and find more stable combinations of assets.
🔹 Method
Here you choose which deviation model you want to use: Z-Score or S-Score.
Both methods calculate spread deviation but use different formulas, which can give different signal behavior depending on the pair.
Examples of these two methods are shown earlier in this description.
🔹 Period
This parameter defines how many bars are used to calculate the average deviation for the pair.
If you set Period = 300, the indicator looks back 300 bars and calculates the typical spread deviation over that window.
For example, if the average deviation over 300 bars is around 1%, then a move to 2% or more will push Z/S Score closer to its boundary levels, since such a deviation is considered abnormal for that lookback period.
🔹 Invert
This setting is used for negatively correlated pairs.
Some instruments have a positive correlation in the range from +0.8 to +1.0 (strong positive correlation), while others show a negative correlation from −0.8 to −1.0, meaning they usually move in opposite directions.

A classic example is the pair EURUSD and DXY.
As shown in the screenshot above, these instruments often have strong negative correlation due to macro factors and typically move in opposite directions: when EURUSD is rising, DXY is falling, and vice versa.
Such pairs can also be traded with our indicator.
To do this, we use the Invert option, which effectively flips one of the assets (as shown in the screenshot below). After inversion, both instruments are brought to a “same-direction” behavior from the model’s point of view.

From there, you trade the pair in the same way as a positively correlated one:
you open both legs in the same direction (both long or both short) depending on the spread and Score, and then wait for the spread between the inverted pair to converge back toward its mean.
🔀 HEDGE COEFFICIENT
The next block of settings is related to the hedge coefficient.
This defines how much margin is allocated to each leg of the pair.
The classic approach in pair trading is to split the position equally between both assets.
For example, if you allocate 100 USD to a trade, the standard model would open 50 USD long on one asset and 50 USD short on the other.
This works well for pairs with similar volatility, such as BTCUSDT / ETHUSDT
However, if you use a pair like BTCUSDT / DOGEUSDT, the volatility of these assets is very different.
They can still be correlated, but their amplitude is not the same. While Bitcoin might move 2%, Dogecoin can move 10% over the same period.
Because of that, for pairs with strongly different volatility, we can use a hedge coefficient and, for example, enter with 30 USD on one leg and 70 USD on the other, taking the volatility difference into account.
This is the main idea behind the Hedge Coefficient section and its primary use.
The indicator includes 6 methods of calculating the coefficient:
We leave it to the trader to decide which algorithm works best for their specific pair and style.
Below are the settings inside this section:

🔹 Method
When Auto Hedge is enabled, you can select which method to use from the list above.
The chosen method will automatically calculate the hedge coefficient between the two legs.
🔹 Hedge Coefficient
This is the manual hedge ratio per trade when Auto Hedge is disabled.
By default it is set to 1, which means the position is opened 50/50 between the two assets.
🔹 Min Allowed Hedge Coef.
This is the minimum allowed hedge coefficient.
By default it is 0.2, which means the model will not go below a 20% / 80% split between the legs.
🔹 MA Length
For methods that use moving averages (for example Beta EMA), this parameter sets the period used to calculate the hedge coefficient.
🛠️ STRATEGY SETTINGS
The next important block is Strategy Settings.
Here you define the core parameters used for backtesting: trading commission, position size, entry / exit logic, Stop Loss, Take Profit, and other rules that describe how you want the strategy to operate.
Below are all parameters with a detailed explanation.
🔸 Commission %
In this field you set your broker’s fee percentage per trade.
The indicator automatically calculates the correct commission for each leg of every trade. You only need to input the real commission rate that your broker charges for volume. No additional manual calculations are required.
🔸 Main Entry Mode
There are two options for the main entry:
This defines how scale-ins (averaging) are executed. There are two modes:

🔸 Exit Level
This parameter defines at what Score level you want to exit the trade.
By default it is 0, which means the backtester closes the position when Score returns to the neutral (0) zone.
You can also use positive or negative values. Example:
Assume your main entry is configured at a 3 deviation.
You can exit at the 0 level, or you can set Exit Level = 2.
🔸 Stop Loss
Here you define the maximum loss per trade in PnL units.
If a trade reaches the negative PnL value specified in this field and the Stop Loss option is enabled, the indicator will close the trade at a loss.
The Cooldown parameter sets a pause after a losing trade:
the strategy will wait a specified number of bars before opening the next trade.
🔸 Take Profit
Works similar to Stop Loss but for profit targets.
You set the desired PnL value you want to reach.
The trade will be closed when either the Take Profit target is hit or when Score reaches the exit level defined in the settings, whichever occurs first (depending on your configuration).
🔸 Show Qty in currency
When enabled, trade size is displayed in currency (USD) instead of token quantity.
This is useful for quickly understanding position size in monetary terms.
You will see this in the Current Trade panel, which is described later.

🔸 Size Rounding
Controls how many decimal places are used when rounding position size (from 0 to 10 digits after the decimal).
This is also used for the Current Trade panel so you can adjust how detailed or compact the size display should be.
📊 RSI FILTERS
This section is used for additional trade filtering.
RSI can be used in two ways:
In this case a trade is opened when the RSI of the two assets reaches opposite zones.
Example:
If the threshold is set to 30, then:
All extra entries after that will be executed either by Spread or by Z/S Score, depending on your Extra Entries Mode.

Below are the parameters in this block:
🎨 MAIN CHART STYLING
This section controls the visual appearance of trades on the main chart.
You can customize how the second asset line is drawn, as well as the icons for entries, scale-ins, and exits, including their size and style.

▫️ Price Line
This is the line that shows the price of the second asset and the relative difference between the two instruments.
You can adjust the line thickness and color to make it more readable on your chart.
▫️ Adjust Price Line by Hedge Coefficient
When this option is enabled, the second asset’s line is normalized by the hedge coefficient.
If you turn it off, the hedge coefficient will not be applied to the second asset’s line, and it will be displayed in raw form.
▫️ Entry Label
Here you can customize how the entry markers look:
choose the color, icon style, and size of the label that marks each trade entry and scale-in on the chart.
▫️ Exit Label
Similarly, you can define the color, icon style, and size of the label used for exits.
This helps visually separate entries and exits and makes it easier to read the trade history directly from the chart.
🎯 INDICATOR PANEL
This section controls the settings of the indicator panel, which works like an oscillator and allows you to visualize multiple metrics in one place.
You can flexibly enable, style, and scale each parameter.

🔹 Score
Displays the main deviation metric between the two assets.
You can customize the color and line thickness of the Score plot.
🔹 Spread
Shows the spread between the two assets.
It starts calculating from the moment the trade is opened.
You can adjust its color and thickness for better visibility.
🔹 Total Profit
Displays the cumulative profit for this pair and strategy as a line that grows (or falls) over time.
Color, opacity, and line thickness can be customized.
🔹 Unrealized PNL
Once a trade is opened, this line shows the current PnL of the active position.
It also lets you see historical drawdowns on the pair.
Color and thickness can be adjusted.
🔹 Released PNL
Shows the realized PnL of each closed trade as bars.
Useful for quickly evaluating the result of every individual trade in the backtest.
🔹 Correlation
Plots the correlation coefficient between the two assets as a graph, so you can visually track how stable or unstable the relationship between them is over time.
🔹 Hedge Coefficient
Shows the hedge coefficient as a line, which helps understand how the model is rebalancing exposure between the two legs depending on their behavior.
For each metric there is also a 📎 Stretch option.
Stretch allows you to compress or expand the scale of a specific line to visually align metrics with different ranges on the same panel and make the chart easier to read.
📈 PROFIT CHART
Since TradingView does not natively support proper backtesting for pair trading, this indicator includes its own profit curve for the pair.
You can visually see how the strategy performed over historical data: whether there were deep drawdowns, abnormal profit spikes, or stable equity growth over time. This makes it much easier to evaluate the quality of the pair and the strategy on history.

In the settings of this section you can flexibly customize how the profit chart is displayed:
labels, position of the panel, padding, and other visual details.
Everything depends on your personal preferences, so we give full control over styling:
you can adjust the look of the profit chart to match your layout or completely hide it from the chart if you do not need it.
📌 CURRENT TRADE
This section controls the current trade table.
When there is an active trade on the chart, the panel displays all key information for the open position:
The main thing you can do with this table is customize its appearance:
you can change the size, position on the chart, background and text colors, as well as separate coloring for positive / negative PnL and different colors for long and short positions.
📅 BACKTEST RESULTS
The next key block is Backtest Results.
This results table with detailed metrics gives you an extended view of how the pair and strategy perform: win rate, profit factor, long/short breakdown, and more than 20 additional stats that help you evaluate the potential of your setup.
⚠️ First of all, it is important to note ⚠️
past performance does not guarantee future results.
Every trader must keep this in mind and factor these risks into their strategy.
The table shows metrics in three cuts:
You can fully customize this results table to fit your workflow:
hide metrics you don’t need, change colors, opacity, and other visual styles, and reorder the focus of the stats according to your trading style.
This way the backtest block can show only the metrics that matter to you most and remain clean and readable during analysis.
📣 ALERTS
The next section is dedicated to alerts.
Here you can configure all signals you need, both for manual trading and for full automation of this pair trading strategy. This block is designed to cover most practical use cases.
The indicator supports two alert modes:
🔹1 Alert Type
List of supported placeholders:Pine Script®
🔹2 Alert Type
List of supported placeholders:Pine Script® You can use these placeholders to build any JSON structure or custom alert text required by your trading bot, exchange API, or automation service.
In this post I’ve explained how the indicator works, the core concept behind this pair trading strategy, and shown practical examples of trades together with a detailed breakdown of each unique feature inside the tool.
We have invested a lot of work into building this indicator and we truly hope it will help you trade pair strategies more efficiently and more profitably by giving you structured, strategy-specific information that is difficult to obtain in any other way.
⚠️ Please also remember that past performance does not guarantee future results.
Always evaluate the risks, the robustness of your setup, and your own risk tolerance before entering any position, and make independent, well-considered decisions when using this or any other strategy.
It is a specialized tool for trading pairs, built around working with two correlated instruments at the same time.
The indicator is designed specifically for pair trading logic: it helps track the relationship between two assets, identify statistical deviations, and generate signals for opening and managing long/short combinations on both legs of the pair.
Below in this description I will go through the core functions of the indicator and the main concepts behind the strategy so you can clearly understand how to apply it in your trading.
📌 CONCEPT
The core idea of pair trading is to find and trade correlated instruments that usually move in a similar way.
When these two assets temporarily diverge from each other, a trading opportunity appears.
In such moments, the relatively overvalued asset is sold (short leg), and the relatively undervalued asset is bought (long leg).
When the spread between them narrows and both instruments revert back toward their typical relationship (mean), the position is closed and the trader captures the profit from this convergence.
In practice, one leg of the pair can end up in a loss while the other generates a larger profit.
Due to the difference in performance between the two assets, the combined result of the pair trade can still be positive.
✅ KEY FEATURES:
- 2 deviation types (Z-Score and S-Score)
- Invert signals mode
- Hedge Coefficient (position size balancing between both legs)
- 6 hedge modes
- Entries based on Score or RSI
- Extra entries based on Score or Spread
- Stop Loss
- Take Profit
- RSI Filter
- RSI Pivot Mode
- Built-in Backtester Strategy
- Lower Timeframe Backtester Strategy
- Live trade panel for current position
- Equity curve chart
- 21 performance metrics in the backtester
- 2 alert types
🔗 SCORE
Score is the core deviation metric between the two assets in the pair.
For example, if you are trading ETHUSDT/BTCUSDT, the indicator analyzes the relationship ETH/BTC, and when one leg temporarily diverges from the other, this difference is reflected in the Score value.
In other words, Score shows how much the current spread between the two instruments deviates from its typical state and is used as the main signal source for pair entries and exits.
In the screenshot above you can see how Score looks in our indicator.
Depending on how large the difference is between the two assets, the Score value can move in a range from −N to +N
- When Score is in the −N zone, this is a 🟢 long zone for the first asset and a short zone for the second.
Using the ETH/BTC example: when Score is deeply negative, you open a long on ETH and a short on BTC at the same time, then close both legs when Score returns back to the 0 zone (balance between the two assets). - When Score is in the +N zone, this is a 🔴 short zone for the first asset and a long zone for the second.
In the same ETH/BTC example: when Score is strongly positive, you short ETH and long BTC, and again close both positions when Score comes back to the neutral 0 zone.
Inside the indicator we added two different formulas for calculating the spread between the two legs of the pair: Z-Score and S-Score.
These approaches measure deviation in different ways and can produce slightly different signals depending on the chosen pair and its behavior.
This allows you to switch between Z-Score and S-Score and choose the method that gives more stable and cleaner signals for your specific instruments.
- 🟣 Z-Score – generated 9 entry signals.
It reacts to price fluctuations more smoothly and usually stays within a range of approximately −8 to +8. - 🟠 S-Score – generated 5 entry signals.
It reacts to price changes more aggressively and produces wider deviations, often reaching −15 to +15.
⁉️ HOW DOES THE STRATEGY WORK
Here is a basic example of how you can trade this pair trading strategy using our indicator and its signals.
In the classic approach the trade consists of one initial entry and several scale-ins (averaging) if the spread continues to move against the position.
- The first entry is opened when Score reaches a standard deviation of −2 or +2.
- If price does not revert to the mean and moves further against the position so that Score expands to −3 or +3, the strategy performs the first scale-in.
- If Score extends to −4 or +4, a second scale-in is added.
- If the spread grows even more and Score reaches −5 or +5, a third scale-in is executed.
After that the position waits until Score returns back to the 0 level, where the whole pair position is closed.
This is the standard model of classical pair trading.
However there are many variations:
- using Stop Loss and Take Profit,
- exiting earlier or later than the 0 zone,
- scaling in not by Score but by Spread, since Score is not linear while Spread is linear,
- entering when RSI on both tickers shows opposite extremes, for example RSI 20 on one asset and RSI 80 on the other, and so on.
We designed the indicator to cover as many of these variations as possible and added flexible tools so you can build your own pair trading logic on top of it.
Below is an example of a classic pair trade with two entries: one main entry and one extra entry (scale-in).
The pair SUIUSDT / PENGUUSDT shows a high correlation, and on one of the trades the sequence looked like this:
A −2 Score deviation occurred into the long zone and triggered the Main Entry.
🔹 Main Entry
- Long SUIUSDT – Margin: 5,000 USD, Entry price: 1.5708
- Short PENGUUSDT – Margin: 5,000 USD, Entry price: 0.011793
🔸 Extra Entry
- Long SUIUSDT – Margin: 5,000 USD, Entry price: 1.5938
- Short PENGUUSDT – Margin: 5,000 USD, Entry price: 0.012173
❎ Exit
- SUIUSDT P&L: −403.34 USD, Exit price: 1.5184
- PENGUUSDT P&L: +743.73 USD, Exit price: 0.011089
- ✅ Total P&L: +340.39 USD
On different assets the size and speed of the spread movement will vary, but the principle remains the same.
This is just one example to illustrate how the strategy works in practice using simplified theoretical balances.
⚙️ MAIN SETTINGS
After explaining how the strategy works, we can move to the indicator settings and their logic.
The first block is Main Settings, which controls how the pair is built, how the spread is calculated, and how the backtest is performed.
The core idea of the indicator is to backtest historical data, generate entry signals, show open-position parameters, and provide all necessary metrics for both discretionary and algorithmic trading.
This is a complete framework for analyzing a pair of assets and building a trading system around them. Below I will go through the main parameters one by one.
🔹 Exclude Dates
Allows you to exclude abnormal periods in the pair’s history to remove outlier trades from the backtest.
This is useful when the market experienced extreme news events, listing spikes, or other non-typical situations that distort statistics.
🔹 Pair
Here you select the second asset for your pair.
For example, if your main chart is BTCUSDT, in this field you choose a correlated asset such as ETHUSDT, and the working pair becomes BTCUSDT / ETHUSDT.
The indicator then calculates spread, Score, and all related metrics based on this asset combination.
🔹 Lower Timeframe
This is a special mode for backtesting on a lower timeframe while using a higher timeframe chart to extend the history limit.
For example, if your TradingView plan provides only 5,000 bars of history on the current timeframe, you can switch your chart to a higher timeframe and select a lower timeframe in this setting.
The indicator will then reconstruct the pair logic using up to 99,000 bars of lower timeframe data for backtesting.
This allows you to test the pair on a much longer historical period and find more stable combinations of assets.
🔹 Method
Here you choose which deviation model you want to use: Z-Score or S-Score.
Both methods calculate spread deviation but use different formulas, which can give different signal behavior depending on the pair.
Examples of these two methods are shown earlier in this description.
🔹 Period
This parameter defines how many bars are used to calculate the average deviation for the pair.
If you set Period = 300, the indicator looks back 300 bars and calculates the typical spread deviation over that window.
For example, if the average deviation over 300 bars is around 1%, then a move to 2% or more will push Z/S Score closer to its boundary levels, since such a deviation is considered abnormal for that lookback period.
- A larger Period means that only bigger deviations will be treated as anomalies.
- A smaller Period makes the model more sensitive and treats smaller deviations as anomalies.
🔹 Invert
This setting is used for negatively correlated pairs.
Some instruments have a positive correlation in the range from +0.8 to +1.0 (strong positive correlation), while others show a negative correlation from −0.8 to −1.0, meaning they usually move in opposite directions.
A classic example is the pair EURUSD and DXY.
As shown in the screenshot above, these instruments often have strong negative correlation due to macro factors and typically move in opposite directions: when EURUSD is rising, DXY is falling, and vice versa.
Such pairs can also be traded with our indicator.
To do this, we use the Invert option, which effectively flips one of the assets (as shown in the screenshot below). After inversion, both instruments are brought to a “same-direction” behavior from the model’s point of view.
From there, you trade the pair in the same way as a positively correlated one:
you open both legs in the same direction (both long or both short) depending on the spread and Score, and then wait for the spread between the inverted pair to converge back toward its mean.
🔀 HEDGE COEFFICIENT
The next block of settings is related to the hedge coefficient.
This defines how much margin is allocated to each leg of the pair.
The classic approach in pair trading is to split the position equally between both assets.
For example, if you allocate 100 USD to a trade, the standard model would open 50 USD long on one asset and 50 USD short on the other.
This works well for pairs with similar volatility, such as BTCUSDT / ETHUSDT
However, if you use a pair like BTCUSDT / DOGEUSDT, the volatility of these assets is very different.
They can still be correlated, but their amplitude is not the same. While Bitcoin might move 2%, Dogecoin can move 10% over the same period.
Because of that, for pairs with strongly different volatility, we can use a hedge coefficient and, for example, enter with 30 USD on one leg and 70 USD on the other, taking the volatility difference into account.
This is the main idea behind the Hedge Coefficient section and its primary use.
The indicator includes 6 methods of calculating the coefficient:
- Cumulative RMA
- Beta OLS
- Beta TLS
- Beta EMA
- RMA Range
- RMA Delta
We leave it to the trader to decide which algorithm works best for their specific pair and style.
Below are the settings inside this section:
🔹 Method
When Auto Hedge is enabled, you can select which method to use from the list above.
The chosen method will automatically calculate the hedge coefficient between the two legs.
🔹 Hedge Coefficient
This is the manual hedge ratio per trade when Auto Hedge is disabled.
By default it is set to 1, which means the position is opened 50/50 between the two assets.
🔹 Min Allowed Hedge Coef.
This is the minimum allowed hedge coefficient.
By default it is 0.2, which means the model will not go below a 20% / 80% split between the legs.
🔹 MA Length
For methods that use moving averages (for example Beta EMA), this parameter sets the period used to calculate the hedge coefficient.
🛠️ STRATEGY SETTINGS
The next important block is Strategy Settings.
Here you define the core parameters used for backtesting: trading commission, position size, entry / exit logic, Stop Loss, Take Profit, and other rules that describe how you want the strategy to operate.
🔸 Commission %
In this field you set your broker’s fee percentage per trade.
The indicator automatically calculates the correct commission for each leg of every trade. You only need to input the real commission rate that your broker charges for volume. No additional manual calculations are required.
🔸 Main Entry Mode
There are two options for the main entry:
- Score - This is the primary entry method based on Z/S Score.
When Score reaches the deviation level defined in the settings below, the strategy opens the first position.
For example, if you set “Entry at 2 deviations”, the trade will be opened when Score hits ±2. - RSI Only - Alternative entry method based on RSI divergence between the two assets.
The exact RSI levels are defined in the RSI settings section below.
For example, if you set the entry threshold at 30, then when one asset has RSI below 30 and the second one has RSI above 70, the first entry will be triggered.
This defines how scale-ins (averaging) are executed. There are two modes:
- Score - Works the same way as the main entry, but for additional entries.
For example, the main entry can be at 2 deviations, the first scale-in at 3, the second at 4, etc. - Spread - This mode uses the Spread (difference between the two assets) starting from the main entry moment.
As the spread continues to widen, the strategy can add extra entries based on spread growth rather than Score.
Since Score is a non-linear metric and Spread is linear, in some configurations averaging by Spread can produce better results than averaging by Score. This is pair- and strategy-dependent.
- Deviation / Spread threshold
- Entry size
- Main Entry – first field (deviation / spread), second field (position size)
- Entry 2 – first field (deviation / spread), second field (position size)
- Entry 3 – first field (deviation / spread), second field (position size)
- Entry 4 – first field (deviation / spread), second field (position size)
🔸 Exit Level
This parameter defines at what Score level you want to exit the trade.
By default it is 0, which means the backtester closes the position when Score returns to the neutral (0) zone.
You can also use positive or negative values. Example:
Assume your main entry is configured at a 3 deviation.
You can exit at the 0 level, or you can set Exit Level = 2.
- If your initial entry was at −3, the position will be closed when Score reaches +2.
- If your initial entry was at +3, the position will be closed when Score reaches −2.
Here you define the maximum loss per trade in PnL units.
If a trade reaches the negative PnL value specified in this field and the Stop Loss option is enabled, the indicator will close the trade at a loss.
The Cooldown parameter sets a pause after a losing trade:
the strategy will wait a specified number of bars before opening the next trade.
🔸 Take Profit
Works similar to Stop Loss but for profit targets.
You set the desired PnL value you want to reach.
The trade will be closed when either the Take Profit target is hit or when Score reaches the exit level defined in the settings, whichever occurs first (depending on your configuration).
🔸 Show Qty in currency
When enabled, trade size is displayed in currency (USD) instead of token quantity.
This is useful for quickly understanding position size in monetary terms.
You will see this in the Current Trade panel, which is described later.
🔸 Size Rounding
Controls how many decimal places are used when rounding position size (from 0 to 10 digits after the decimal).
This is also used for the Current Trade panel so you can adjust how detailed or compact the size display should be.
📊 RSI FILTERS
This section is used for additional trade filtering.
RSI can be used in two ways:
- as a primary entry signal,
- or as an extra filter for entries based on Z/S Score.
In this case a trade is opened when the RSI of the two assets reaches opposite zones.
Example:
If the threshold is set to 30, then:
- when one asset has RSI below 30, and
- the second asset has RSI above 70 (100 − 30),
All extra entries after that will be executed either by Spread or by Z/S Score, depending on your Extra Entries Mode.
Below are the parameters in this block:
- RSI Length – standard RSI period setting.
- RSI Pivot Mode – when enabled, RSI is used as an additional filter together with Z/S Score. The indicator looks for a reversal pattern on RSI (pivot behavior). If RSI forms a reversal structure, the trade is allowed to open. If not, the signal is skipped until a proper RSI pivot is formed.
- Entry RSI Filter – here you define the RSI thresholds used for RSI-based entries. These are the same boundary levels described in the example above.
🎨 MAIN CHART STYLING
This section controls the visual appearance of trades on the main chart.
You can customize how the second asset line is drawn, as well as the icons for entries, scale-ins, and exits, including their size and style.
▫️ Price Line
This is the line that shows the price of the second asset and the relative difference between the two instruments.
You can adjust the line thickness and color to make it more readable on your chart.
▫️ Adjust Price Line by Hedge Coefficient
When this option is enabled, the second asset’s line is normalized by the hedge coefficient.
If you turn it off, the hedge coefficient will not be applied to the second asset’s line, and it will be displayed in raw form.
▫️ Entry Label
Here you can customize how the entry markers look:
choose the color, icon style, and size of the label that marks each trade entry and scale-in on the chart.
▫️ Exit Label
Similarly, you can define the color, icon style, and size of the label used for exits.
This helps visually separate entries and exits and makes it easier to read the trade history directly from the chart.
🎯 INDICATOR PANEL
This section controls the settings of the indicator panel, which works like an oscillator and allows you to visualize multiple metrics in one place.
You can flexibly enable, style, and scale each parameter.
🔹 Score
Displays the main deviation metric between the two assets.
You can customize the color and line thickness of the Score plot.
🔹 Spread
Shows the spread between the two assets.
It starts calculating from the moment the trade is opened.
You can adjust its color and thickness for better visibility.
🔹 Total Profit
Displays the cumulative profit for this pair and strategy as a line that grows (or falls) over time.
Color, opacity, and line thickness can be customized.
🔹 Unrealized PNL
Once a trade is opened, this line shows the current PnL of the active position.
It also lets you see historical drawdowns on the pair.
Color and thickness can be adjusted.
🔹 Released PNL
Shows the realized PnL of each closed trade as bars.
Useful for quickly evaluating the result of every individual trade in the backtest.
🔹 Correlation
Plots the correlation coefficient between the two assets as a graph, so you can visually track how stable or unstable the relationship between them is over time.
🔹 Hedge Coefficient
Shows the hedge coefficient as a line, which helps understand how the model is rebalancing exposure between the two legs depending on their behavior.
Stretch allows you to compress or expand the scale of a specific line to visually align metrics with different ranges on the same panel and make the chart easier to read.
📈 PROFIT CHART
Since TradingView does not natively support proper backtesting for pair trading, this indicator includes its own profit curve for the pair.
You can visually see how the strategy performed over historical data: whether there were deep drawdowns, abnormal profit spikes, or stable equity growth over time. This makes it much easier to evaluate the quality of the pair and the strategy on history.
In the settings of this section you can flexibly customize how the profit chart is displayed:
labels, position of the panel, padding, and other visual details.
Everything depends on your personal preferences, so we give full control over styling:
you can adjust the look of the profit chart to match your layout or completely hide it from the chart if you do not need it.
📌 CURRENT TRADE
This section controls the current trade table.
When there is an active trade on the chart, the panel displays all key information for the open position:
- direction for each ticker (long or short),
- required position size for each leg,
- entry price for both assets,
- and real-time PnL for each leg separately,
you can change the size, position on the chart, background and text colors, as well as separate coloring for positive / negative PnL and different colors for long and short positions.
📅 BACKTEST RESULTS
The next key block is Backtest Results.
This results table with detailed metrics gives you an extended view of how the pair and strategy perform: win rate, profit factor, long/short breakdown, and more than 20 additional stats that help you evaluate the potential of your setup.
past performance does not guarantee future results.
Every trader must keep this in mind and factor these risks into their strategy.
The table shows metrics in three cuts:
- All Entries
- Main Entries
- Extra Entries (scale-ins)
- Profit – total profit for each entry type.
- Winrate – win rate for this pair.
- Profit Factor – ratio of gross profit to gross loss for the strategy.
- Trades – number of trades in the backtest.
- Wins – number of winning trades.
- Losses – number of losing trades.
- Long Profit – profit generated by long positions.
- Short Profit – profit generated by short positions.
- Longs – total number of long trades.
- Shorts – total number of short trades.
- Avg. Time – average time spent in a trade.
- Correlation – current correlation between the two assets in the pair.
- Bars Processed – number of bars used in the analysis.
- Max Drawdown – maximum historical drawdown of the strategy.
- Biggest Loss – the largest single losing trade in the backtest.
- Recommended Hedge – recommended hedge coefficient based on historical behavior.
- Max Spread – maximum positive spread observed in history.
- Min Spread – maximum negative spread observed in history.
- Avg. Max Spread – average of positive extreme spread values (above 0).
- Avg. Min Spread – average of negative extreme spread values (below 0).
- Avg Positive Spread – average positive spread across all trades (only values above 0).
- Avg Negative Spread – average negative spread across all trades (only values below 0).
- Current Spread – current spread between the assets when a trade is open.
hide metrics you don’t need, change colors, opacity, and other visual styles, and reorder the focus of the stats according to your trading style.
This way the backtest block can show only the metrics that matter to you most and remain clean and readable during analysis.
📣 ALERTS
The next section is dedicated to alerts.
Here you can configure all signals you need, both for manual trading and for full automation of this pair trading strategy. This block is designed to cover most practical use cases.
- Single Alert – one universal custom alert for all events.
- Two Alerts – separate alerts for each ticker so you can receive different messages per asset.
- Main Entry – when the main entry is triggered.
- Entry 2 – when the first scale-in is executed.
- Entry 3 – when the second scale-in is executed.
- Entry 4 – when the third scale-in is executed.
- Exit Alert – when the position is closed.
- StopLoss Alert – when Stop Loss is hit.
- TakeProfit Alert – when Take Profit is hit.
🔹1 Alert Type
List of supported placeholders:
{{event}} – trigger name ('Entry 1', 'Exit').
{{dir_1}} – 'Long' or 'Short' for the main ticker.
{{dir_2}} – 'Long' or 'Short' for the other ticker.
{{action_1}} – 'Buy', 'Sell' or 'Close' for the main ticker.
{{action_2}} – 'Buy', 'Sell' or 'Close' for the other ticker.
{{price_1}} – price for the main ticker.
{{price_2}} – price for the other ticker.
{{qty_1}} – order size for the main ticker.
{{qty_2}} – order size for the other ticker.
{{ticker_1}} – main ticker (e.g. 'BTCUSD').
{{ticker_2}} – other ticker (e.g. 'ETHUSD').
{{time}} – candle open time in UTC.
{{timenow}} – signal time in UTC.
🔹2 Alert Type
List of supported placeholders:
{{event}} – trigger name ('Entry 1', 'Exit', 'SL', 'TP').
{{action}} – 'Buy', 'Sell' or 'Close'.
{{price}} – order price.
{{qty}} – order size.
{{ticker}} – ticker (e.g. 'BTCUSD').
{{time}} – candle open time in UTC.
{{timenow}} – signal time in UTC.
In this post I’ve explained how the indicator works, the core concept behind this pair trading strategy, and shown practical examples of trades together with a detailed breakdown of each unique feature inside the tool.
We have invested a lot of work into building this indicator and we truly hope it will help you trade pair strategies more efficiently and more profitably by giving you structured, strategy-specific information that is difficult to obtain in any other way.
⚠️ Please also remember that past performance does not guarantee future results.
Always evaluate the risks, the robustness of your setup, and your own risk tolerance before entering any position, and make independent, well-considered decisions when using this or any other strategy.
초대 전용 스크립트
이 스크립트는 작성자가 승인한 사용자만 접근할 수 있습니다. 사용하려면 요청 후 승인을 받아야 하며, 일반적으로 결제 후에 허가가 부여됩니다. 자세한 내용은 아래 작성자의 안내를 따르거나 RunRox에게 직접 문의하세요.
트레이딩뷰는 스크립트의 작동 방식을 충분히 이해하고 작성자를 완전히 신뢰하지 않는 이상, 해당 스크립트에 비용을 지불하거나 사용하는 것을 권장하지 않습니다. 커뮤니티 스크립트에서 무료 오픈소스 대안을 찾아보실 수도 있습니다.
작성자 지시 사항
Unlock premium indicators here: https://RunRox.com/tv
Access RunRox premium indicators: RunRox.com/tv
Join our FREE Discord for Strategy, Live Translation and more: discord.gg/RunRox
Join our FREE Discord for Strategy, Live Translation and more: discord.gg/RunRox
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
초대 전용 스크립트
이 스크립트는 작성자가 승인한 사용자만 접근할 수 있습니다. 사용하려면 요청 후 승인을 받아야 하며, 일반적으로 결제 후에 허가가 부여됩니다. 자세한 내용은 아래 작성자의 안내를 따르거나 RunRox에게 직접 문의하세요.
트레이딩뷰는 스크립트의 작동 방식을 충분히 이해하고 작성자를 완전히 신뢰하지 않는 이상, 해당 스크립트에 비용을 지불하거나 사용하는 것을 권장하지 않습니다. 커뮤니티 스크립트에서 무료 오픈소스 대안을 찾아보실 수도 있습니다.
작성자 지시 사항
Unlock premium indicators here: https://RunRox.com/tv
Access RunRox premium indicators: RunRox.com/tv
Join our FREE Discord for Strategy, Live Translation and more: discord.gg/RunRox
Join our FREE Discord for Strategy, Live Translation and more: discord.gg/RunRox
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.