OPEN-SOURCE SCRIPT
BTC(Sats Stacking) - CDC Action zone filter

Type: Indicator (Pine v6) • Category: Strategy Tools / DCA • Overlay: Yes
Overview
This indicator simulates fixed-amount Bitcoin DCA (dollar-cost averaging) and lets you apply a CDC Action Zone filter to only buy in specific market conditions. It plots EMA(12/26) lines with a shaded zone (green when fast > slow, red when slow > fast), shows buy markers on the chart when a DCA event actually executes, and displays a concise performance table.
The simulation tracks real invested capital (sum of your buys), not hypothetical equity injections, and reports PnL vs invested capital.
Key features
DCA frequency: Everyday, Every week, or Every month
CDC filter: Buy on all days, only when CDC is Green (trend-up above fast EMA), or only when Red (trend-down below fast EMA)
Execution price: Choose to buy at bar close or next bar open
Capital controls: Fixed DCA amount per event, optional max budget cap
Currency support: Portfolio currency label plus optional FX conversion (by symbol or manual rate)
Chart visuals: Buy markers on candles; EMA(12/26) lines with shaded “action zone”
Metrics table: Invested capital, buys executed, BTC accumulated, average price per BTC (quote), equity (portfolio), PnL% vs invested, and CAGR
How it works
CDC state:
Green = EMA(fast) > EMA(slow) and price ≥ EMA(fast)
Red = EMA(fast) < EMA(slow) and price < EMA(fast)
DCA trigger: Fires on new day/week/month boundaries (timeframe-agnostic).
Buy execution: When a DCA event occurs and passes the CDC filter and budget check, the script spends the fixed amount and adds the corresponding BTC at the chosen execution price.
Inputs (highlights)
Simulation
Symbol (blank = current chart), Buy at close/open, DCA amount, Max total invested
DCA Schedule
Everyday / Every week / Every month
CDC Action Zone
Filter mode (All / Green only / Red only), Price source, Fast/Slow EMA lengths (defaults 12/26)
Currency / Conversion
Portfolio currency label, Convert on/off, By symbol (e.g., OANDA:USDTHB) or Manual rate
Backtest Range
Optional start/end dates
Style
Show EMA lines and zone, colors and opacities, buy marker size and color
Display
Show qty/price labels on buys, show metrics table, number formatting
Metrics
Invested capital: Sum of all DCA spends in your portfolio currency
Equity (portfolio): BTC holdings marked to market and converted back if FX is enabled
PnL % vs invested: (Equity / Invested - 1) × 100
CAGR: Based on elapsed time from first in-range bar to the latest bar
Average price per BTC (quote): Spend in quote currency divided by BTC accumulated
Notes
This is an indicator, not a broker-connected strategy. It simulates buys and displays results without placing orders.
For more realistic fills, use Buy at next bar open.
If your portfolio currency differs from the symbol’s quote currency, enable Convert and supply a conversion symbol or manual rate.
EMA shading is purely visual; the filter logic uses the same EMA definitions.
Attribution & License
Inspired by the DCA idea and community simulations; CDC filtering implemented with standard EMA(12/26) logic.
License: MPL-2.0 (see code header).
Author: MiSuNoJo
Disclaimer
This tool is for research and education only and is not financial advice. Past performance does not guarantee future results. Use at your own risk.
Overview
This indicator simulates fixed-amount Bitcoin DCA (dollar-cost averaging) and lets you apply a CDC Action Zone filter to only buy in specific market conditions. It plots EMA(12/26) lines with a shaded zone (green when fast > slow, red when slow > fast), shows buy markers on the chart when a DCA event actually executes, and displays a concise performance table.
The simulation tracks real invested capital (sum of your buys), not hypothetical equity injections, and reports PnL vs invested capital.
Key features
DCA frequency: Everyday, Every week, or Every month
CDC filter: Buy on all days, only when CDC is Green (trend-up above fast EMA), or only when Red (trend-down below fast EMA)
Execution price: Choose to buy at bar close or next bar open
Capital controls: Fixed DCA amount per event, optional max budget cap
Currency support: Portfolio currency label plus optional FX conversion (by symbol or manual rate)
Chart visuals: Buy markers on candles; EMA(12/26) lines with shaded “action zone”
Metrics table: Invested capital, buys executed, BTC accumulated, average price per BTC (quote), equity (portfolio), PnL% vs invested, and CAGR
How it works
CDC state:
Green = EMA(fast) > EMA(slow) and price ≥ EMA(fast)
Red = EMA(fast) < EMA(slow) and price < EMA(fast)
DCA trigger: Fires on new day/week/month boundaries (timeframe-agnostic).
Buy execution: When a DCA event occurs and passes the CDC filter and budget check, the script spends the fixed amount and adds the corresponding BTC at the chosen execution price.
Inputs (highlights)
Simulation
Symbol (blank = current chart), Buy at close/open, DCA amount, Max total invested
DCA Schedule
Everyday / Every week / Every month
CDC Action Zone
Filter mode (All / Green only / Red only), Price source, Fast/Slow EMA lengths (defaults 12/26)
Currency / Conversion
Portfolio currency label, Convert on/off, By symbol (e.g., OANDA:USDTHB) or Manual rate
Backtest Range
Optional start/end dates
Style
Show EMA lines and zone, colors and opacities, buy marker size and color
Display
Show qty/price labels on buys, show metrics table, number formatting
Metrics
Invested capital: Sum of all DCA spends in your portfolio currency
Equity (portfolio): BTC holdings marked to market and converted back if FX is enabled
PnL % vs invested: (Equity / Invested - 1) × 100
CAGR: Based on elapsed time from first in-range bar to the latest bar
Average price per BTC (quote): Spend in quote currency divided by BTC accumulated
Notes
This is an indicator, not a broker-connected strategy. It simulates buys and displays results without placing orders.
For more realistic fills, use Buy at next bar open.
If your portfolio currency differs from the symbol’s quote currency, enable Convert and supply a conversion symbol or manual rate.
EMA shading is purely visual; the filter logic uses the same EMA definitions.
Attribution & License
Inspired by the DCA idea and community simulations; CDC filtering implemented with standard EMA(12/26) logic.
License: MPL-2.0 (see code header).
Author: MiSuNoJo
Disclaimer
This tool is for research and education only and is not financial advice. Past performance does not guarantee future results. Use at your own risk.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.