OPEN-SOURCE SCRIPT

RSI vs Longs/Shorts Margin Ratio Percentage Rank

Atualizado
This indicator plots the RSI of the current token and the percentage rank, of the RSI, of the ratio of a long margined token to a short margined token.

By default it plots the RSI of the current token with a color based on percentage rank the RSI of BITFINEX:BTCUSDLONGS divided by BITFINEX:BTCUSDSHORTS, so the assumption is that you are using it on a BTC chart. While you can select any Tradingview symbol for your Long and Short tokens I don't think you will get meaningful results unless you select a long and short margined token that matches your chart symbol, such as BITFINEX:ETHUSDLONGS and BITFINEX:ETHUSDSHORTS if you're trading ETHUSD. Even using margined tokens the results may not be meaningful, if there is not enough trade volume in the token, or if they are being manipulated, so you must backtest everything.

The three plot options are:
• Colored RSI - RSI plotted with colors based on the Longs/Shorts ratio
• Background Color - White RSI plot with Longs/Shorts ratio as background color
• RSI + Ratio - White RSI with Longs/Shorts ratio plotted in color
The chart shows all three options on an hourly BITFINEX:SOLUSD chart with BITFINEX:SOLUSDSHORTS and BITFINEX:SOLUSDLONGS.

By default it also plots a short term moving average and it can also plot the raw ratio rather than the percentage rank if selected.

This script started out as "RSI vs BITFINEX BTC Longs/Shorts Margin Ratio Percentage Rank" by me. I was interested in the ratio of BITFINEX:BTCUSDLONGS to BITFINEX:BTCUSDSHORTS as a measure of market sentiment and how that sentiment would magnify RSI changes. The volatility of the BTCUSDLONGS : BTCUSDSHORTS ratio was too low to get a good read, using a percent rank of the RSI of the ratio made the results more visible. After a discussion with jason5480 I saw how opening it up to all margined Long / Short pairs was the best way forward. Unfortunately the name no longer matched the script, so I had to publish a new script.
Notas de Lançamento
1.01
• Added an automatic pair option
By default the indicator now plots the RSI of the current token with a color based on percentage rank the RSI of BITFINEX:'token'LONGS divided by BITFINEX:'token'USDSHORTS. If you are using a chart that does not have BITFINEX LONGS and SHORTS tokens it will error and display nothing.

• Got rid of the average, not needed

• Added alerts
Alerts can be triggered and or shown on the chart when the Ratio is Above / Below specified values, with the option to filter by the RSI being beyond the displayed upper and lower limits and or the RSI above / below its moving average.
The three indicators displayed in this update show the 1hr ETHUSD with alerts based on:
Indicator 1: RSI Beyond Bands, RSI MA Filter, Ratio Below 5 and Ratio Above 95
Indicator 2: RSI Beyond Bands, Ratio Below 2 and Ratio Above 98
Indicator 3: RSI MA Filter, Ratio Below 2 and Ratio Above 98
Notas de Lançamento
1.02
• Automatic matching is now far more likely to show a result, it will show the USD pair most of the time unless a closer match exists or manually set.
• Celebrating the easier matching with an ADAAUD chart that is automatically showing AUAUSD Longs and Shorts.
• Set long and short symbol defval to '' so BINANCE:BTCUSDLONGS doen't show up in the chart unless it is set.
• Since the manual settings now default to '' it will be automatic unless a manual setting is entered. If it has been entered it is not automatic, so Auto setting is no longer required,
• If the currency is USD, UST or BTC it will automatically use the chart pair for longs and shorts.
• If the currency is EUR, GBP or JPY and the base is ETH or BTC it will automatically use the chart pair for longs and shorts.
• Otherwise it will use the USD pair for longs and shorts.
Notas de Lançamento
1.03
• Added histogram style.
My new favourite and the bottom in the examples on the chart. Displays the ratio as an area histogram with a base of 50, when used with the RBlG spectrum as in the example the unimportant area in the middle doesn't show anything.
• Modified to just display the normal RSI where no BITFINEX LONGS exist.
I use this indicator on my standard daily chart and when I was looking at non-crypto or crypto without BITFINEX LONGS and SHORTS it was just showing an error. Modified to just show the normal RSI in those situations.
• Added DevLucem Divergence library to alert on RSI divergences.
Alerts can now be triggered on RSI divergences, thanks DevLucem for the library!
Notas de Lançamento
Updated Description to match current functionallity.
bitfinexlongsbitfinexshortslongshortpercentageLONGSHORTRATIORelative Strength Index (RSI)sentiment

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal