OPEN-SOURCE SCRIPT

Inter-Exchanges Crypto Price Spread Clouds (Tartigradia)

Updated
Display variations in min-max and median values of high, low and close across 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).

Compared with my other "Inter-Exchanges Crypto Price Spread Deviation" indicator, this one overlays directly on the chart, and offers a different take based on the same premisses. Instead of summarizing volatility via standard deviation, here we display clouds of the range of values that were observed.

A big advantage of this approach is that it can also be used to determine safe stop loss levels, especially the values of percentile rank (i.e., what are the high values that were observed in at least 50% of exchanges?).

Indeed, all price levels are displayed in the indicator's status bar:
  • green for high values,
  • red for low values,
  • aqua for median,
  • purple for average,
  • The first two values are max and min values of high across exchanges (in green).
  • The next two values are max and min of low across exchanges (in red).
  • The next two values are median (aqua) and average (purple).
  • The last two values are percentile rank values for high (green) and low (red) respectively.


Another advantage is that the high (green) vs low (red) clouds can be seen as representing the buying or selling pressure respectively across exchanges, and this may in itself provide a signal to know whether one side is winning.

Link to my other complementary indicator:
Inter-Exchanges Crypto Price Spread Deviation (Tartigradia)


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.
Release Notes
* Fix names of average and median of close price.
* Increase visibility of clouds.
Bands and ChannelsHistorical VolatilitymedianrealizedvolatilityspreadstoplossvolatilityindicatorVolatility Stop

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer