OPEN-SOURCE SCRIPT

Chiki-Poki BFXLS Longs Shorts Abs Normalized Volume Pro by RRB

Updated
Chiki-Poki BFXLS Longs vs Shorts Absolute Normalized Volume Value Pro by RagingRocketBull 2018
Version 1.0

This indicator displays Longs vs Shorts in a side by side graph, shows volume's absolute price value and normalized volume of Longs/Shorts for the current asset. This allows for more accurate L/S comparisons (like a log scale for volume) since volume on spot exchanges (Bitstamp, Bitfinex, Coinbase etc) is measured in coins traded, not USD traded. Similarly, L/S is usually the amount of coins in open L/S positions, not their total USD value. On Bitmex and other futures exchanges volume is measured in USD traded, so you don't need to apply the Volume Absolute Price Value checkbox to compare L/S. You should always check first whether your source is measured in coins or USD.

Chiki-Poki BFXLS primarily uses *SHORTS/LONGS feeds from Bitfinex for the current crypto asset, but you can specify custom L/S source tickers instead.
This 2-in-1 works both in the Main Chart and in the indicator pane below. You can switch between Main/Sub Window panes using RMB on the indicator's name and selecting Move To/Pane Above/Below.
This indicator doesn't use volume of the current asset. It uses L/S ticker's OHLC as a source for SHORTS/LONGS volumes instead. Essentially L/S [OHLC] => L/S Volume == L/S

Features:
- Display Longs vs Shorts side by side graph for the current crypto asset, i.e. for BTCUSD - BTCUSDLONGS/BTCUSDSHORTS, for ETHUSD - ETHUSDLONGS/ETHUSDSHORTS etc.
- Use custom OHLC ticker sources for Longs/Shorts from different exchanges/crypto assets with/without exchange prefix.
- Plot Longs/Shorts as lines or candles
- Show/Hide L/S, Diff, MAs, ATH/ATL
- Use Longs/Shorts Volume Absolute Price Value (Price * L/S Volume) instead of Coins Traded in open L/S positions to compare total L/S value/capitalization
- Normalize L/S Volume using Price / Price MA / L/S Volume MA
- Supports any existing type of MA: SMA, EMA, WMA, HMA etc
- Volume Absolute Price Value / Normalize also works on candles
- Oscillator mode with negative axis (works in both Main Chart/Subwindow panes).
- Highlight L/S Volume spikes above L/S MAs in both lines/oscillator.
- Change L/S MA color based on a number of last rising/falling L/S bars, colorize candles
- Display L/S volume as 1000s, mlns, or blns using alpha multiplier

1. based on BFXLS Longs vs Shorts and Compare Style, uses plot*, security and custom hma functions
2. swma has a fixed length = 4, alma and linreg have additional offset and smoothing params

Notes:
- Make sure that Left Price Scale shows up with Auto Fit Data enabled. You can reattach indicator to a different scale in Style.
- It is not recommended to switch modes multiple times due to TradingView's scale reattachment bugs. You should switch between Main Chart and Sub Window only once.

- When the USD price of an asset is lower you can trade more coins but capitalization value won't be as significant as when there are less coins for a higher price. Same goes for Shorts/Longs.
Current ATH in shorts doesn't trigger a squeeze because its total value is now far less than before and we are in a bear market where it's normal to have a higher number of shorts.

- You should always subtract Hedged L/S from L/S because hedged positions are temporary - used to preserve the value of the main position in the opposite direction and should be disregarded as such.

- Low margin rates increase the probability of a move in an underlying direction because it is cheaper. High margin rates => the market is anticipating a move in this direction, thus a more expensive rate. Sudden 5-10x rate raises imply a possible reversal soon. high - 0.1%, avg - 0.01-0.02%, low - 0.001-0.005%

You can also check out:
- BFXLS Longs/Shorts on BFXData
- Bitfinex L/S margin rates and Hedged L/S on datamish
- Bitmex L/S on Coinfarm.online
Release Notes
Changes in ver 2.0:
- Longs/Shorts Ratio/Inversed Ratio options with full intraday support (free accounts are limited to D1+ L/S ratios only, this script does not have such limitation)
- Custom price ticker option. You can use any ext OHLC price source instead of the current symbol's price, essentially completely ignoring the underlying chart data.
- [CURRENT], [DEFAULT] meta variables for custom tickers. Now you can swap sources between all custom tickers. [CURRENT] - current symbol's price, [DEFAULT] or "" - default ticker value.
For example, you can open BTCUSDSHORTS chart instead of BTCUSD, assign a shorts ticker: [CURRENT] (to use current price as a source for shorts), and price ticker: BTCUSD (use external price source).
- Normalized/Abs Price Value indicator Labels
- Changed some titles

Notes:
- typing BTCUSDSHORTS * BTCUSD in the ticker field of the main chart will get you the same result as Abs Price Value option of this script
- typing BTCUSDLONGS - BTCUSDSHORTS is the same as showing L/S Diff in this script
- typing BTCUSDSHORTS / BTCUSDLONGS will get you S/L ratio (free accounts are limited to TFs >= D1 only).
- you can't use SMA/EMA in the ticker field to manually normalize current symbol this way
Absolute Price Oscillator (APO)longslongshortMoving AveragesnormalizedshortsSimple Moving Average (SMA)ValueVolume Indicator

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