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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。