OPEN-SOURCE SCRIPT

Bitfinex Longs/Shorts {v2} [m59]

Updated
Description and documentation can be found within the script.
Release Notes
  • There are new data types and formats. Fiddle with the indicator settings and check out the updated docs (within the script) for detailed information about it.
  • The *regular* value used to be called "Absolute" because I was contrasting it with "Percent". The more accurate name for those values is "Cumulative", as they are running totals of the changes from bar to bar.
  • Longs Percent is now the default rendered value. It used to be the cumulative value of longs. Longs Percent is probably a better default since it moves according to the activity of both longs and shorts.
  • Shorts Percent is gone because it's redundant, being the mirror of Longs Percent. It's a waste of visual and mental energy to ever think of it. Just use Longs Percent.
  • The "Highlight Extremes" feature is gone for now as it was only relevant to Long % and there are many other data types and formats now. I'll consider whether and how to re-implement this. It may just be in the way and better off gone.
  • Don't 100x long the top and get REKT. That's ridiculous. Don't even 1x long the top. Just don't do it, friends.
Release Notes
  • The printed values and order of them did not agree with the documentation.
  • Buy and sells lookback deltas are removed from the printed values. I didn't find them useful enough to justify the additional screen clutter.
Release Notes
  • The symbol selection inputs are gone and replaced by the much better Base and Quote inputs which have lists of options. This does away with the need to go searching for what BFX long/short data is available. These options were pre-generated by scraping the Bitfinex website. A bonus of this change is that the printed indicator arguments are changed from the ambiguous and/or pointless "Auto" and "XXXUSD" to explicit values that are more clear in intent/significance, default "This Base, This Quote".
  • Added a Denomination option that allows the data to be rendered in other currencies. For example, BTCUSD longs and shorts values are denominated in BTC by default, but you could denominate them in USD instead, or even have BTCUSD longs and shorts values denominated in JPY.


Check out the updated documentation (within the script) for more details!
Release Notes
  • Removed Base and Quote options in favor of a simple Pairs list. Base and Quote were neat, but most of the BFX LS charts on TV have no data and most combinations of bases and quotes don't work, so the pairs list seems a better way to go.
  • Denominations are limited to Base, BTC, and USD. Those work on all pairs. The rest probably just lead to more user confusion and frustration than useful data.
Release Notes
  • Fixed the denomination logic. The delta/gain/loss formats, when denominated, were showing changes in the value of the margin positions in the base currency. That explanation is hard to digest, so here's an example: There is 1 BTC of longs, and a BTC is worth $6000, so that's $6000 of longs. If another BTC is added, that's 2 BTC of longs, worth $12000. On the next bar, if no longs are added but the price of BTCUSD goes up to $7000, then the delta view would have shown a $2000 gain in longs, even though no additional longs were added. ((2 * $7000) - (2 * $6000) = $2000) vs ((2 - 2) * $7000 = 0). To fix this, the final value to be rendered is denominated, rather than the initial ls data from which all calculated values are derived.
Release Notes
  • New Feature! You can now go to the settings and choose "Aggregate Data -> Matching Base" to pull data from all pairs matching the selected base currency. For example, ETH has a lot of margin activity on both ETHUSD and ETHBTC. With this new feature, both pairs will be used, as well as the other ETH base pairs.
  • The order of the printed values has changed! Longs (Percent) now comes first, then Longs (Net) and then Longs. In other words, the longs values are reverses, or in even other words, Longs (Percent) was switched with Longs, that way Longs and Shorts can be next to one another, and it's easier on the eyes to find the Longs (Percent) value.
  • Possibly fixed my goof brain and fixed how denomination is applied. Longs Percent was being multiplied by the denomination modifier, and the printed values were not denominated. This should all be correct now.
  • The denomination options now read "in Base", "in BTC" and "in USD" because I like the options printed on the indicator to be descriptive.
longsmarginOscillatorssentimentshortsTrend Analysis

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