OPEN-SOURCE SCRIPT
DCA vs Market Timing vs ATH Buying - Backtesting

Compare investment timing strategies with equal capital to see which actually performs best.
This indicator backtests whether buying at all-time highs, waiting for pullbacks, or regular DCA builds more wealth over time.
Each strategy receives the same monthly budget (default $100). The difference is when they invest:
Key Metrics:
The Deployed% column reveals the hidden cost of waiting. Pullback strategies often underperform because they keep too much cash idle, missing the gains that occur while waiting for corrections.
Use Cases:
This indicator backtests whether buying at all-time highs, waiting for pullbacks, or regular DCA builds more wealth over time.
Each strategy receives the same monthly budget (default $100). The difference is when they invest:
- ATH Strategy: Invests when price hits new highs (1-year lookback default)
- Pullback Strategies: Wait for 5%, 10%, 15%, or 20% corrections before investing
- Regular DCA: Invests monthly regardless of price
Key Metrics:
- Budget: Total capital allocated (equal for all)
- Value: Current portfolio value (stocks + cash)
- Return%: Overall performance
- Deployed%: How much capital is actually invested vs sitting in cash earning 0%
- Trades: Number of investments made
The Deployed% column reveals the hidden cost of waiting. Pullback strategies often underperform because they keep too much cash idle, missing the gains that occur while waiting for corrections.
Use Cases:
- Validate whether waiting for corrections is worth the opportunity cost
- Test different pullback thresholds on historical data
- Compare ATH investing vs DCA vs market timing
- Analyze performance across different time periods
- Results typically show that time in the market beats timing the market—this tool lets you prove it with data.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
Hedge Fund Manager at Maverick Capital | Wealth Educator | 20+ yrs investing | Stocks, ETFs & Crypto alerts | Join Henrique Wealth Academy for trade alerts & indicators → skool.com/be-limitless/
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
Hedge Fund Manager at Maverick Capital | Wealth Educator | 20+ yrs investing | Stocks, ETFs & Crypto alerts | Join Henrique Wealth Academy for trade alerts & indicators → skool.com/be-limitless/
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。