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提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。