OPEN-SOURCE SCRIPT
Atualizado Automatic comparison of symbols depending on custom list

In the indicator settings, specify a list of tickers and the corresponding symbol for comparison (e.g. TVC:DXY). Each new list must be on a separate line. The line must begin with the symbol for comparison, then an equal sign (=), and then a list of tickers separated by commas (e.g. OANDA:XAUUSD, OANDA:XAGUSD). If the ticker selected in the chart window is not found in any of the lists, then the symbol from the first list, which is specified before the equal sign, will be used as the symbol for comparison. For example:
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
OANDA:SPX500USD = BINANCE:BTCUSDT
***
Автоматическое сравнение символов в зависимости от настраиваемого списка
В настройках индикатора укажите список тикеров и соответствующий символ для сравнения. Каждый новый список должен быть на отдельной строке. В начале строки должен быть указан символ для сравнения (например, TVC:DXY), затем знак равенства (=) и после него список тикеров, разделенных запятыми (например, OANDA:XAUUSD, OANDA:XAGUSD). Если выбранный в окне графика тикер не будет найден ни в одном из списков, то в качестве символа для сравнения ему будет соответствовать символ из первого списка, который указан перед знаком равенства. Например:
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
OANDA:SPX500USD = BINANCE:BTCUSDT
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
OANDA:SPX500USD = BINANCE:BTCUSDT
***
Автоматическое сравнение символов в зависимости от настраиваемого списка
В настройках индикатора укажите список тикеров и соответствующий символ для сравнения. Каждый новый список должен быть на отдельной строке. В начале строки должен быть указан символ для сравнения (например, TVC:DXY), затем знак равенства (=) и после него список тикеров, разделенных запятыми (например, OANDA:XAUUSD, OANDA:XAGUSD). Если выбранный в окне графика тикер не будет найден ни в одном из списков, то в качестве символа для сравнения ему будет соответствовать символ из первого списка, который указан перед знаком равенства. Например:
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
OANDA:SPX500USD = BINANCE:BTCUSDT
Notas de Lançamento
Added display of lines for the compared symbol (enabled in the indicator settings in the "Display lines of highest and lowest bar > ✅" field), corresponding to the price of the highest (green line) and lowest (red line) bars of the compared symbol, in the visible part of the screen. The lines change dynamically when scrolling or changing the scale of the chart (within 2-3 seconds).***
Добавлено отображение линий для сравниваемого символа (включается в настройках индикатора в поле "Display lines of highest and lowest bar > ✅"), соответствующих цене самого высокого (зеленая линия) и самого низкого (красная линия) баров сравниваемого символа, в видимой части экрана. Линии меняются динамически при скроллинге или изменении масштаба графика (в течении 2-3 секунд).
Notas de Lançamento
Added display of percentage change in the closing price of the current bar of the compared symbol relative to the closing price of the previous bar, taking into account the current timeframe of the chart (can be disabled in the settings in the "Display percentage change" field). Percentage change greater than or equal to 0.5% will be highlighted in green, less than or equal to -0.5% will be highlighted in red, otherwise it will be gray.Added the ability to specify in the ticker list only a prefix with a colon at the end; in this case, if the ticker selected in the chart window is not found in any of the lists, then the symbol (before the equal sign) from the list containing the corresponding prefix with a colon will correspond to it as a comparison symbol.
Also now if the ticker selected in the chart window is found in subsequent ticker lists or a ticker prefix is found, then for all corresponding symbols that are specified before the equal sign in these lists, the percentage change in the price on the indicator panel will also be displayed. The symbol before the equal sign only from the first list in which the ticker selected in the chart window was found is used as a comparison symbol.
You can use comments in the list, for this the line must begin with the # symbol.
For example:
# DXY — comparison symbol for tickers not listed
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
# SPX500USD — for all tickers with OANDA prefix
OANDA:SPX500USD = OANDA:, BINANCE:BTCUSDT
BINANCE:BTCUSDT = OANDA:SPX500USD
OANDA:NATGASUSD = OANDA:SPX500USD
For OANDA:XAUUSD, OANDA:XAGUSD, OANDA:BCOUSD and tickers that are not listed (e.g. OANDA:NATGASUSD, COMEX:GC1!), the comparison symbol will be TVC:DXY. For OANDA:XAUUSD and OANDA:XAGUSD, the price change from the previous bar will also be displayed for OANDA:SPX500USD. For OANDA:SPX500USD, the comparison symbol will be OANDA:BCOUSD, and the price change will also be displayed for BINANCE:BTCUSDT and OANDA:NATGASUSD. For BINANCE:BTCUSDT, the comparison symbol will be OANDA:SPX500USD.
***
Добавлено отображение процентного изменения цены закрытия текущего бара сравниваемого символа относительно цены закрытия предыдущего бара с учетом текущего таймфрейма графика (можно отключить в настройках в поле "Display percentage change"). Процентное изменение больше или равно 0.5% будет выделено зеленым цветом, меньше или равно -0.5% будет выделено красным цветом, иначе будет серого цвета.
Добавлена возможность указывать в списке тикеров только префикс с двоеточием в конце, в таком случае, если выбранный в окне графика тикер не будет найден ни в одном из списков, то в качестве символа для сравнения ему будет соответствовать символ (перед знаком равенства) из списка, содержащего соответствующий префикс с двоеточием.
Также теперь если выбранный в окне графика тикер будет найден в последующих списках тикеров или будет найден префикс тикера, то для всех соответствующих символов, которые указаны перед знаком равенства в этих списках, будет также отображаться процентное изменение цены на панели индикатора. Символ перед знаком равенства только из первого списка, в котором был найден выбранный в окне графика тикер, используется в качестве символа для сравнения.
Можно использовать комментарии в списке, для этого строка должна начинаться с символа #.
Например:
# DXY — comparison symbol for tickers not listed
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
# SPX500USD — for all tickers with OANDA prefix
OANDA:SPX500USD = OANDA:, BINANCE:BTCUSDT
BINANCE:BTCUSDT = OANDA:SPX500USD
OANDA:NATGASUSD = OANDA:SPX500USD
Для OANDA:XAUUSD, OANDA:XAGUSD, OANDA:BCOUSD и тикеров, которых нет в списке (например: OANDA:NATGASUSD, COMEX:GC1!), символом для сравнения будет TVC:DXY. Для OANDA:XAUUSD и OANDA:XAGUSD также будет отображаться изменение цены относительно предыдущего бара для OANDA:SPX500USD. Для OANDA:SPX500USD символом для сравнения будет OANDA:BCOUSD, также будет отображаться изменение цены для BINANCE:BTCUSDT и OANDA:NATGASUSD. Для BINANCE:BTCUSDT символом для сравнения будет OANDA:SPX500USD.
Notas de Lançamento
Fixed a bug when displaying the percentage change in price for a compared symbol, if, for example, the ticker in the chart window is traded on a weekend, and the symbol for comparison is not traded, then the percentage change in price is displayed for the last bar on Friday.Notas de Lançamento
Fixed a bug where the chart did not stretch to the full height of the indicator panel when displaying lines corresponding to the price of the highest and lowest bars of the compared symbol.Notas de Lançamento
Added the ability to set a global symbol for all tickers (in the indicator settings in the "Global symbol" field) - this is convenient when you need to temporarily change the symbol for comparison.***
Добавлена возможность установки глобального символа для всех тикеров (в настройках индикатора в поле "Global symbol") — это удобно, когда нужно временно изменить символ для сравнения.
Notas de Lançamento
Fixed a bug that occurred when adding only a prefix with a colon at the end to the ticker list.Notas de Lançamento
If "Compared symbol -> Display percentage change / Display price-> ✅" fields are enabled in the indicator settings and more than 1 symbol is displayed in the indicator window, the current price of the compared symbol will also be displayed:— To switch the chart display for the desired symbol, specify its number in "Chart" field or part of its name in "Ticker" field (if "Chart" = 1).
— If the price has been rising over the last 3 bars (changes in "Compared symbol -> Rise/Fall" field), it will be highlighted in green 🟢, if falling — red 🔴, otherwise — grey ⚪️. Symbols with the COT prefix (including COT2, COT3) are an exception.
COT Prefix Symbols — these are data from weekly CFTC reports on the positions of the largest market participants (banks, funds, and producers). Unlike price, COT reflects the distribution of power between speculators (MMP, NCP, LMP, AMP) and hedgers (CP, SP).
👀 A detailed description of the groups is available in the comments in "Symbol lists" field (at the end of the list), where default settings for popular futures are also contained (including additional hints).
For COT symbols containing group identifiers "_MMP", "_NCP", "_LMP", "_AMP", "_CP", "_SP", including net positions (long "_L" - short "_S"), the value color changes based on the COT Index value calculated over the interval specified in "COT data -> Index L" field.
COT Index = 100 * (Current Value - Min Value) / (Max Value - Min Value), the result is smoothed using a 3-period Exponential Moving Average (EMA 3), the value of which can be changed in "COT data -> Smth" field.
If for the "_MMP", "_NCP", "_LMP", "_AMP" groups the COT Index > 80 — the value will be highlighted in red 🔴, if < 20 — in orange 🟠, if > 50 — in green 🟢. If for the "_CP", "_SP" groups the COT Index > 80 — the value will be highlighted in green 🟢, if < 20 — in red 🔴. You can change the threshold values in "COT data" group of fields. The chart line in the indicator window for such symbols is displayed in a semi-transparent color to the left of the segment specified in "COT data -> Index L" field.
Additional settings in the "COT data" block:
— "Auto switch chart for intraday timeframe -> ✅": if an intraday timeframe is selected, then if a symbol without a COT prefix is present, the chart display will be automatically switched for the first such symbol.
— "Show short names -> ✅": If "Compared Symbol -> Display Prefix" field is disabled, then COT symbol names will be displayed without the numeric code and with short names for net positions, for example, "F_MMP_NET".
— "Show COT Index -> ✅": instead of the COT symbol value (color of which depends on COT Index), the COT Index value will be displayed, as well as "(+)" if the COT symbol value is > 0, and "(-)" if < 0.
To receive notifications about signals (just a reason for analysis, not a call to action) when creating an alert, you must select the condition "Any alert() function is call":
— "Check all COT symbols in Alerts -> ✅": alerts will come if the color of each COT symbol value (which depends on the COT Index) becomes green 🟢 (long), orange 🟠 (exhaustion), or red 🔴 (short). Otherwise, if at least one COT symbol value becomes such a color, provided that the other values are gray ⚪️ or the same color.
— "Check COT Open Interest in Alerts -> ✅": alerts will come only if the color of the COT OI (if present) value matches the signal color for COT symbols, for example: "🟢 XAUUSD · 1W · F_MMP_NET ➕ F_CP_NET ➕ F_OI".
When "Display signals on chart -> ✅" field is enabled, then at the bottom of the window, circles corresponding to the signal color (depending on "Check all COT symbols in Alerts / Check COT Open Interest in Alerts -> ✅" settings) will be displayed, including grey ⚪️ if the color of each COT symbol value is grey. When "Highlight -> ✅" field is enabled, signals will be highlighted with a vertical fill (full height of the indicator window). Signals are displayed only in the interval specified in "Index L" field. You can change the color in the indicator style settings in "COT signals" and "Highlighted COT signals" fields.
In the indicator settings in "ATR vs SMA -> L -> ✅" field, you can enable highlighting of high volatility zones for the ticker in the chart window. Upon activation, the chart line in the indicator window (blue by default) will be colored purple in zones where volatility is higher than average for the ticker in the chart window (not in the oscillator window). Volatility calculation is performed by comparing the current ATR value (period in "L" field) with its moving average SMA (period in "SMA" field). Volatility is considered high when the condition is met: ATR 14 > SMA 104 of ATR 14.
In "Economic indicators -> List" field, you can specify a list of economic indicator tickers. Each ticker must be on a separate line (for example: ECONOMICS:USBCOI), then an equals sign (=) and after it the logic — the number 0 or 1. In this case, the difference between its last and previous value will be displayed as the ticker value, as well as "(+)" if the last value > 0, and "(-)" if < 0. After the logic, two ticker values can be specified, also separated by a comma — the min and max threshold (for example: 1, 50, 55), in which case its last value will be displayed as the ticker value. If the max threshold is not specified or is less than the min, it will be equal to the min.
When logic is set to 0, the ticker value will be highlighted in green 🟢 when the difference < 0 or when the value < min threshold (for example: 50), and conversely — in red 🔴 when the difference > 0 or when the value > max threshold (for example: 55). If logic is set to 1, the value will be highlighted in red 🔴 when the difference < 0 or when the value < min threshold, and conversely — in green 🟢 when the difference > 0 or when the value > max threshold. In other cases — in grey ⚪️. You can also add a name to be displayed instead of the ticker; to do this, it is necessary to add a hash symbol (#) and the name after the logic and the max/min thresholds (for example: ECONOMICS:USBCOI = 1, 50, 55 #ISM Mfg 🛠). Except for COT symbols, for which only the name is used. In the ticker list, you can also use empty lines and add comments if you specify a hash symbol (#) at the beginning of a new line (for example: #ISM Manufacturing PMI).
👀 Tickers added as economic indicators are displayed in the oscillator window only if they are linked to the current symbol in the chart window in "Symbol lists" field. Or if you enable "Show all Indicators" field. If the list of symbols does not fit even in the oscillator window expanded to full screen, or if there are more than 40 compared symbols, then you can use pagination, i.e., specify the symbol number in "Start" field, starting from which the next 40 symbols will be displayed. The "Economic indicators -> List" field already contains default settings for US economic indicator chains.
Notas de Lançamento
Fixed a bug when enabling the "COT data -> Auto switch chart for intraday timeframe" field.Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.