OPEN-SOURCE SCRIPT
Dual Harmonic-based AHR DCA (Default :BTC-ETH)

A panel indicator designed for dual-asset BTC/ETH DCA (Dollar Cost Averaging) decisions.
It is inspired by the Chinese community indicator "AHR999" proposed by “Jiushen”.
How to use:
What you’ll see:
Core idea:
Use an AHR based on Harmonic Moving Average (HM) — a ratio that measures how “cheap or expensive” price is relative to both its short-term mean and long-term trend.
The original AHR999 used SMA and was designed for BTC only.
This indicator extends it with cross-exchange percentile mapping, allowing the empirical “opportunity/risk” zones of the AHR999 (on Bitstamp) to adapt automatically to the current market pair.
The indicator derives two adaptive thresholds:
These thresholds are compared with the current HM-based AHR of BTC and ETH to decide which asset is cheaper, and whether it is good to DCA or not, or considering to sell(When it in risk area).
This version uses
Concept summary
Recommended settings (1D):
Notes:
When the rolling window is filled (2920 bars by default), thresholds are first calculated and then visually backfilled as left-extended lines.
The “buy markers” and “decision table” are light simulations without fees or funding costs — for rhythm and relative analysis, not backtesting.
It is inspired by the Chinese community indicator "AHR999" proposed by “Jiushen”.
How to use:
- Lower HM-based AHR → cheaper (potential buy zone).
- Higher HM-based AHR → more expensive (potential risk zone).
- Higher than Risk Threshold → consider to sell, but not suitable for DCA.
- When both AHR lines are below the Risk threshold → buy the cheaper one (or split if similar).
- If one AHR is above Risk → buy the other asset.
- If both are above Risk → simulation shows “STOP (both risk)”.
- Not limited to BTC/ETH — you can freely change symbols in the input panel
to build any dual-asset DCA pair you want (e.g., BTC/BNB, ETH/SOL, etc.).
What you’ll see:
- Two lines: AHR BTC (HM) and AHR ETH (HM)
- Two dashed lines: OppThreshold (green) and RiskThreshold (red)
- Colored fill showing which asset is cheaper (BTC or ETH)
- Buy markers:
- B = Buy BTC
- E = Buy ETH
- D = Dual (split budget) - Top-right table: prices, AHRs, thresholds, qOpp/qRisk%, simulation, P&L
- Labels showing last-bar AHR values
Core idea:
Use an AHR based on Harmonic Moving Average (HM) — a ratio that measures how “cheap or expensive” price is relative to both its short-term mean and long-term trend.
The original AHR999 used SMA and was designed for BTC only.
This indicator extends it with cross-exchange percentile mapping, allowing the empirical “opportunity/risk” zones of the AHR999 (on Bitstamp) to adapt automatically to the current market pair.
The indicator derives two adaptive thresholds:
- OppThreshold – opportunity zone
- RiskThreshold – risk zone
These thresholds are compared with the current HM-based AHR of BTC and ETH to decide which asset is cheaper, and whether it is good to DCA or not, or considering to sell(When it in risk area).
This version uses
- Display base: Binance (default: perpetual) with HM-based AHR
- Percentile base: Bitstamp spot SMA-AHR (complete, stable history)
- Rolling window: 2920 daily bars (~8 years) for percentile tracking
Concept summary
- AHR measures the ratio of price to its long-term regression and short-term mean.
- HM replaces SMA to better reflect equal-fiat-cost DCA behavior.
- Cross-exchange percentile mapping (Bitstamp → Binance) keeps thresholds consistent with the original AHR999 interpretation.
Recommended settings (1D):
- DCA length (harmonic): 200
- Log-regression lookback: 1825 (≈5 years)
- Rolling window: 2920 (≈8 years)
- Reference thresholds: 0.45 / 1.20 (AHR999 empirical priors)
- Tie split tolerance (ΔAHR): 0.05
- Daily budget: 15 USDT (simulation)
- All display options can be toggled: table, markers, labels, etc.
Notes:
When the rolling window is filled (2920 bars by default), thresholds are first calculated and then visually backfilled as left-extended lines.
The “buy markers” and “decision table” are light simulations without fees or funding costs — for rhythm and relative analysis, not backtesting.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.