INVITE-ONLY SCRIPT

Bitfinex Spot vs Margin Volume - Multi-asset

Updated
The Bitfinex Spot vs Margin Volume - Multi-asset indicator was designed to help understanding how volume is composed between Spot and Margin transactions, considering all possible scenarios.  

It provides valuable additional insight on how 'smarter money' is behaving in anticipation of possible upcoming moves, and can contribute to current analysis toolkits.

To request access, please send me a direct message.

Main features:
  • Spot vs. Margin insight for all margin-enabled Bitfinex pairs (dynamically detected from Chart).
  • Can be used on non-Bitfinex Charts which share same Ticker (eg. BTCUSD on Bitfinex or Bitstamp). Also dynamically detected.
  • Can be used in a separate pane (default) or added to main chart, as a standard volume indicator.

    Shapes' meanings:
  • Colored bars represent scenario where maximum possible volume is attributed to Spot transactions (and its corresponding effect on Margin, if any).
  • Histograms (thin bars) represent scenario where maximum possible volume is attributed to Margin transactions (and its corresponding effect on Spot, if any).
  • When volume information leaves room for ambiguity, there will be a mismatch between maximums and minimums. Truth will be somewhere in the middle.
  • By default, Spot and Margin volumes are stacked up, as in traditional volume bar style.This can be disabled in Options - in which case Margin volumes are presented below zero line (this can facilitate some readings; see notes).
  • Standard volume for current chart's pair is presented in light gray, in the background. It helps seeing realtime volume and any surplus volume in relation to Bitfinex's.

    Colors:
  • By default, Spot volume bars are colored in blue, but you can choose to use price closes to define them instead - as in traditional volume indicators.
  • You can also choose to invert Spot and Margin colors, so that Spot volumes are presented in higher contrast.
  • Margin volumes are, by default, colored based on whether Longs or Shorts were more relevant.

    Direction attribution:
  • Default ratio threshold to define above-mentioned relevance is 1.1 (10%). (eg.: if Longs were greater than Shorts, Longs' volume must be at least 10% grater than Shorts' for direction of movement to be attributed to Longs). Direction then is defined based on winning side, plus whether openings or closings were dominant.
  • Threshold be configured from 1.01 to N. If ratio is below threshold, direction is considered neutral (yellow/orange colors).
  • Based on this assessment, label signals are presented at top area of chart, indicating whether opening(+) or closing(-) Longs or Shorts were the major responsibles for the move.
  • By default, to avoid much cluttering, labels are presented only for greater-than-average (ema 17) margin volumes. This can also be customized in Options.

    Claim transactions:
  • Claim transactions are margin positions closed with traders' own existing assets being handed in to lenders. Thus, they do not impact order books -- and volume -- when executed.
  • Still, they are an additional, potentially valuable source of information, and the indicator is able to detect and report them.
  • Green triangle-like area shapes represent Longs closed with Claim transaction(s). Likewise, similar red shapes represent Shorts closed with Claim transactions.
  • This topic is explained in greater detail in this Bitfinex article.

    Notes:[1]When using stacked up visualization, values in data window do not correspond to actual margin volumes. To see actual values, change to non-stacked up mode, and ignore negative sign.
    [2]The lower the time frame, the more precise it gets.

    To request access, please send me a direct message.

    For questions and feedbacks, please share them in comments section below.

    Thank you, and best of success on your trades.
Release Notes
V. 1.0.1

  • Sample usage insights: snapshot
  • Alternate Spot and Margin Colors fixed to come disabled by default (original intended behavior).
Release Notes
V. 1.1

New features:

  • Automatic detection of corresponding margin-enabled pair for many crypto Derivatives (eg. shows BTCUSD volume for XBTUSD charts). List to be updated regularly (suggestions are welcome!)
  • Allows selecting a custom pair for seeing margin-enabled volume, independently of chart's pair.
  • Display / hide margin-enabled pair real time volume bar (preliminary volume info).
  • Display / hide chart's pair standard volume. Allows seeing any bar-to-bar surplus from a non-Bitfinex or different, custom pair. Please note that very large volumes (eg. highly leveraged XBTUSD) may compromise comparability / viewability, even if volume conversion is enabled (see below). For this reason, this feature is 'off' by default.
  • Convert chart's pair volume to matched or custom pair basis (eg. shows BitMEX's XBTCUSD volume in BTC, using Bitfinex's price close for the bar). Useful to enhance comparability / viewability. Effective if 'Display chart's pair volume' setting is on).
  • Other minor improvements on settings page.


A special thanks to yatrader2 for helping out with some Pine Script for this release.

Hope you all enjoy the update!

And Happy New Year!
Release Notes
[V. 1.1.1/b]

  • Fix on 'Custom' pair feature.
  • Enhanced presentation chart.
bitfinexbitfinexlongsbitfinexshortscryptoCryptocurrencymarginmargin-tradingspotVolume IndicatorVolume

Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact PhinkTrade for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases, you can find a good open-source alternative for free in our Community Scripts.

Author's instructions

Want to use this script on a chart?

Warning: please read before requesting access.

Price Finder Indicator Quick Start: bit.ly/phinktrade_pricefinder_qs2
Telegram Channel: bit.ly/phinktrade_tc
Twitter: bit.ly/phinktrade_tw
Also on:

Disclaimer