OPEN-SOURCE SCRIPT
Bitcoin Miners Max Pain (BMMP)

Bitcoin Miner Max Pain (BMMP)
Core idea: Bitcoin always gravitates back toward its production cost. When price gets way too far above or below what it costs to mine a coin — and miners start showing stress signals — that's historically been where the real turning points happen.
I built the MEI to capture exactly that. It's a composite oscillator that blends four on-chain mining metrics into a single score.
---
How it works:
PPC Ratio (Price-to-Production Cost) — The backbone of the indicator. Estimates what it actually costs to produce 1 BTC using either a difficulty regression model (based on Hayes 2018), a bottom-up electricity model, or an external data feed. When price trades below production cost, miners bleed. When it's multiples above, euphoria is probably peaking.
Difficulty Momentum — Compares fast vs slow rate of change in mining difficulty. Rapidly rising difficulty = miners are expanding aggressively (often late-cycle). Collapsing difficulty = capitulation (often near bottoms).
Puell Multiple — Daily miner revenue relative to the 365-day average. Low values mean miners are earning far less than usual (stress). High values mean revenue is running hot.
Hashrate Z-Score — How far current hashrate deviates from its smoothed trend. Captures whether the network is overextended or contracting.
Each component gets normalized via rolling z-scores so they're on a comparable scale, then weighted into one number.
Reading the signals
- Below -1.5 → Strong Buy — historically these have been generational bottoms
- -1.5 to -0.5 → Accumulation zone
- -0.5 to 0.5 → Fair value / neutral
- 0.5 to 1.5 → Distribution zone
- Above 1.5 → Strong Sell — historically cycle tops
Customization
Pretty much everything is adjustable — the cost model, component weights, lookback periods, signal thresholds. You can toggle individual component lines on/off to see what's driving the composite score at any given time.
Three production cost models to choose from depending on what data you have access to. The difficulty regression works out of the box with free data. The electricity model lets you plug in your own assumptions about fleet efficiency and power costs. Or just feed in an external cost estimate if you have one.
Setup
Apply to BTCUSD daily. You'll need data feeds for difficulty, hashrate, and miner revenue — default tickers point to Quandl/Blockchain.com but alternatives from IntoTheBlock or Glassnode work too. Adjust the ticker inputs to whatever your TradingView plan supports.
Alerts included for all signal transitions — strong buy, buy, sell, strong sell, and zero-line crosses.
This isn't financial advice. It's a tool I built for my own analysis and decided to share. Do your own research, manage your risk, and don't blindly follow any indicator.
Core idea: Bitcoin always gravitates back toward its production cost. When price gets way too far above or below what it costs to mine a coin — and miners start showing stress signals — that's historically been where the real turning points happen.
I built the MEI to capture exactly that. It's a composite oscillator that blends four on-chain mining metrics into a single score.
---
How it works:
PPC Ratio (Price-to-Production Cost) — The backbone of the indicator. Estimates what it actually costs to produce 1 BTC using either a difficulty regression model (based on Hayes 2018), a bottom-up electricity model, or an external data feed. When price trades below production cost, miners bleed. When it's multiples above, euphoria is probably peaking.
Difficulty Momentum — Compares fast vs slow rate of change in mining difficulty. Rapidly rising difficulty = miners are expanding aggressively (often late-cycle). Collapsing difficulty = capitulation (often near bottoms).
Puell Multiple — Daily miner revenue relative to the 365-day average. Low values mean miners are earning far less than usual (stress). High values mean revenue is running hot.
Hashrate Z-Score — How far current hashrate deviates from its smoothed trend. Captures whether the network is overextended or contracting.
Each component gets normalized via rolling z-scores so they're on a comparable scale, then weighted into one number.
Reading the signals
- Below -1.5 → Strong Buy — historically these have been generational bottoms
- -1.5 to -0.5 → Accumulation zone
- -0.5 to 0.5 → Fair value / neutral
- 0.5 to 1.5 → Distribution zone
- Above 1.5 → Strong Sell — historically cycle tops
Customization
Pretty much everything is adjustable — the cost model, component weights, lookback periods, signal thresholds. You can toggle individual component lines on/off to see what's driving the composite score at any given time.
Three production cost models to choose from depending on what data you have access to. The difficulty regression works out of the box with free data. The electricity model lets you plug in your own assumptions about fleet efficiency and power costs. Or just feed in an external cost estimate if you have one.
Setup
Apply to BTCUSD daily. You'll need data feeds for difficulty, hashrate, and miner revenue — default tickers point to Quandl/Blockchain.com but alternatives from IntoTheBlock or Glassnode work too. Adjust the ticker inputs to whatever your TradingView plan supports.
Alerts included for all signal transitions — strong buy, buy, sell, strong sell, and zero-line crosses.
This isn't financial advice. It's a tool I built for my own analysis and decided to share. Do your own research, manage your risk, and don't blindly follow any indicator.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
The Good, the Bad and the Bitcoin — No hype, just data.
Free indicators & honest backtests: youtube.com/@TheGoodTheBadAndTheBitcoin
Free indicators & honest backtests: youtube.com/@TheGoodTheBadAndTheBitcoin
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
The Good, the Bad and the Bitcoin — No hype, just data.
Free indicators & honest backtests: youtube.com/@TheGoodTheBadAndTheBitcoin
Free indicators & honest backtests: youtube.com/@TheGoodTheBadAndTheBitcoin
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.