tartigradia

Inter-Exchanges Crypto Price Spread Deviation (Tartigradia)

tartigradia 已更新   
Measures the deviation of price metrics between various exchanges. It's a kind of realized volatility indicator, as the idea is that in times of high volatility (high emotions, fear, uncertainty), it's more likely that market inefficiencies will appear for the same asset between different market makers, ie, the price can temporarily differ a lot. This indicator will catch these instants of high differences between exchanges, even if they lasted only an instant (because we use high and low values).

Both standard deviation and median absolute deviation (more robust to outliers, ie, exchanges with a very different price from others won't influence the median absolute deviation, but the standard deviation yes).

Compared to other inter-exchanges spread indicators, this one offers two major features:
* The symbol automatically adapts to the symbol currently selected in user's chart. Hence, switching between tickers does not require the user to modify any option, everything is dynamically updated behind the scenes.
* It's easy to add more exchanges (requires some code editing because PineScript v5 does not allow dynamical request.security() calls).

Limitations/things to know:
* History is limited to what the ticker itself display. Ie, even if the exchanges specified in this indicator have more data than the ticker currently displayed in the user's chart, the indicator will show only a timeperiod as long as the chart.
* The indicator can manage multiple exchanges of different historical length (ie, some exchanges having more data going way earlier in the past than others), in which case they will simply be ignored from calculations when far back in the past. Hence, you should be aware that the further you go in the past, the less exchanges will have such data, and hence the less accurate the measures will be (because the deviation will be calculated from less sources than more recent bars). This is thanks to how the array.* math functions behave in case of na values, they simply skip them from calculations, contrary to math.* functions.
版本注释:
* Fix small typos in comments and clarify what needs to be done to add one exchange
版本注释:
* Fix unintelligible sentence in description because of missing words. Here is the corrected version:

Two methods of calculation of deviation are offered: standard deviation and median absolute deviation (more robust to outliers, ie, exchanges with a very different price from others won't influence the median absolute deviation, but the standard deviation yes).

* Also, here is the list of currently implemented exchanges:
INDEX (tradingview historical data)
CRYPTO
BINANCE
KRAKEN
POLONIEX
COINBASE
BITFINEX
GEMINI
版本注释:
Changes:
* Deduplicated code between different ways of calculating deviations.
* Added option to bicolor cloud, so that we can infer buying and selling pressures from volatility.
* Added threshold to standardize sizing across timescales.
* Added background highlight depending on whether high and/or low are beyond threshold.

How to use:
  • If cloud is bicolor, colorize the cloud in green for the high deviation, and red for the low deviation, which can be seen as representing buying pressure vs selling pressure respectively.
  • If cloud is monocolor (or if you look at bicolor cloud's entire size), this can be seen as a quantification of overall volatility across market makers, and hence a sign of a potential upcoming big move.
  • Background is highlighted depending on if high and/or low are beyond threshold: yellow if both are (meaning potential upcoming big move, stronger than either green or red highlight because both buying and selling pressure are through the roof, but not indication about the direction), green if high only (buying pressure may be more important), red if only low is beyond threshold (selling pressure may be more important), no color otherwise.
版本注释:
Changes:
* Replace label with a table, so that the chart is maximally rescaled to the content (the calculated metrics) rather than the label.
* Add a high-low deviations histogram plot, which answers the question: are highs (green cloud) more volatile (bigger) than lows (red cloud)?
* Increase opacity of background highlight.

How to use the histogram (this is in addition to the other "How to use" instructions above):
* The histogram/columns plot answers the simple question: are highs more volatile or are lows? By simply subtracting high deviation - low deviation, we obtain the answer, as a histogram plot, where bars can only appear one side: above zero and green means that highs are more volatile than lows and presumably this indicates more buying pressure; below zero and red means lows are more volatile and may indicate more selling pressure; around zero below the user-defined margin will be gray and means that the value is not significantly deviating from zero so there is no direction - this does not mean that there is no pressure, but the pressure may be there but balanced (about as much high volatility as low volatility, in some cases the background can be highlighted in yellow simultaneously to a 0 histogram value which means that there is high pressure on both sides).
* Note that there is absolutely zero smoothing of data over time, so the clouds and histograms really reflect per-bar resolution data, with no influence of past bars. There is however an aggregation done between exchanges data feeds, as part of the deviation calculation, so there is some loss of accuracy in terms of values that is unavoidable.
版本注释:
Changes:
* Modularize (ie, reuse updated library to deduplicate code and ease maintenance). No change in functionalities compared to previous release.
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?