Bitcoin Miner Extreme Selling

This script is for identifying extreme selling. Judging by the chart, Bitcoin miners often (not always) sell hard for two reasons: to take profit into parabolic price rises, or to stay solvent when the price is very low.
Extreme selling thus often coincides with long-term tops and bottoms in Bitcoin price. This can be a useful EXTRA data point when trying to time long-term Bitcoin spot or crypto equity investment (NOT advice, you remain responsible, etc). The difference between selling measured in BTC and in USD gives a reasonable idea of whether miners are selling to make a profit or to stay solvent.

The idea for using the ratio of miner outflows to reserves comes from the "Bitcoin Miner Sell Pressure" script by the pioneering capriole_charles.
The two calls are identical. Another similarity is that you have to sum the outflows to make it make sense. But it doesn't make much difference, it turns out from testing, to use an average of the reserves, so I didn't. All other code is different.
The script from capriole_charles uses Bollinger bands to highlight periods when sell pressure is high, uses a rolling 30-day sum, and only uses the BTC metrics.
My script uses a configurable 2-6 week rolling sum (there's nothing magical about one month), uses different calculations, and uses BTC , USD, and composite metrics.

Rolling Time Basis: Determines how much data is rolled up. At the lowest level, daily data is too volatile. If you choose, e.g., 1 week, then the indicator displays the relative selling on a weekly basis. Longer time periods, obviously, are smoother but delayed, while shorter time periods are more reactive. There is no "real" time period, only an explicit interpretation.
Show Data > Outflows: Displays the relative selling data, along with a long-term moving average. You might use this option if you want to compare the "real" heights of peaks across history.
Show Data > Delta (the default): Only the difference between the relative selling and the long-term moving average is displayed, along with an average of *that*. This is more signal and less noise.
Base Currency: Configure whether the calculations use BTC or USD as the metric. This setting doesn't use the BTC price at all; it switches the data requested from INTOTHEBLOCK.
If you choose Composite (the default), the script combines BTC and USD together in a relative way (you can't simply add them, as USD is a much bigger absolute value).
In Composite mode, the peaks are coloured red if BTC selling is higher than USD, which usually indicates forced selling, and green if USD is higher, which usually indicates profit-taking. This categorisation is not perfectly accurate but it is interesting insomuch as it is derived from block data and not Bitcoin price.
In BTC or USD mode, a gradient is used to give a rough visual idea of how far from the average the current value is, and to make it look pretty.

Because of the long-term moving averages, the length of the chart does make a difference. I recommend running the script on the longest Bitcoin chart, ticker BLX .
To use it to compare selling with pivots in crypto equities, use a split chart: one BLX with the indicator applied, and one with the equity of your choice. Sync Interval, Crosshair, Time, and Date Range, but not Symbol.

🆓 All my free scripts:
⭐️ Pro scripts:
📗 Articles:
🙋Get help with Pinescript:

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。