OPEN-SOURCE SCRIPT
DCA Percent Signal

Overview
The DCA Percent Signal Indicator generates buy and sell signals based on percentage drops from all-time highs and percentage gains from lowest lows since ATH. This indicator is designed for pyramiding strategies where each signal represents a configurable percentage of equity allocation.
Definitions
DCA (Dollar-Cost Averaging): An investment strategy where you invest a fixed amount at regular intervals, regardless of price fluctuations. This indicator generates signals for a DCA-style pyramiding approach.
Gann Bar Types: Classification system for price bars based on their relationship to the previous bar:
ATH (All-Time High): The highest price level reached during the entire chart period
ATL (All-Time Low): The lowest price level reached since the most recent ATH
Pyramiding: A trading strategy that adds to positions on favorable price movements
Look-Ahead Bias: Using future information that wouldn't be available in real-time trading
Default Properties
Signal Thresholds:
Price Sources:
Filter Options:
Display Options:
How It Works
Buy Signals: Trigger every 10% drop from the all-time highest price reached
Sell Signals: Trigger every 30% increase from the lowest low since the most recent all-time high
Smart Tracking: Uses configurable price sources for signal generation
Key Features
Usage Instructions
Signal Logic
Buy Signals:
Sell Signals:
Limitations
Implementation Notes
The DCA Percent Signal Indicator generates buy and sell signals based on percentage drops from all-time highs and percentage gains from lowest lows since ATH. This indicator is designed for pyramiding strategies where each signal represents a configurable percentage of equity allocation.
Definitions
DCA (Dollar-Cost Averaging): An investment strategy where you invest a fixed amount at regular intervals, regardless of price fluctuations. This indicator generates signals for a DCA-style pyramiding approach.
Gann Bar Types: Classification system for price bars based on their relationship to the previous bar:
- Up Bar: High > previous high AND low ≥ previous low
- Down Bar: High ≤ previous high AND low < previous low
- Inside Bar: High ≤ previous high AND low ≥ previous low
- Outside Bar: High > previous high AND low < previous low
ATH (All-Time High): The highest price level reached during the entire chart period
ATL (All-Time Low): The lowest price level reached since the most recent ATH
Pyramiding: A trading strategy that adds to positions on favorable price movements
Look-Ahead Bias: Using future information that wouldn't be available in real-time trading
Default Properties
Signal Thresholds:
- Buy Threshold: 10% (triggers every 10% drop from ATH)
- Sell Threshold: 30% (triggers every 30% gain from lowest low since ATH)
Price Sources:
- ATH Tracking: High (ATH detection)
- ATL Tracking: Low (low detection)
- Buy Signal Source: Low (buy signals)
- Sell Signal Source: High (sell signals)
Filter Options:
- Apply Gann Filter: False (disabled by default)
- Buy Sets ATL: False (disabled by default)
Display Options:
- Show Buy/Sell Signals: True
- Show Reference Lines: True
- Show Info Table: False
- Show Bar Type: False
How It Works
Buy Signals: Trigger every 10% drop from the all-time highest price reached
Sell Signals: Trigger every 30% increase from the lowest low since the most recent all-time high
Smart Tracking: Uses configurable price sources for signal generation
Key Features
- Configurable Thresholds: Adjustable buy/sell percentage thresholds (default: 10%/30%)
- Separate Price Sources: Independent sources for ATH tracking, ATL tracking, and signal triggers
- Configurable Signals: Uses low for buy signals and high for sell signals by default
- Optional Gann Filter: Apply Gann bar analysis for additional signal filtering
- Optional Buy Sets ATL: Option to set ATL reference point when buy signals occur
- Visual Debug: Detailed labels showing signal parameters and values
Usage Instructions
- Apply to Chart: Use on any timeframe (recommended: 1D or higher for better signal quality)
- Risk Management: Adjust thresholds based on your risk tolerance and market volatility
- Signal Analysis: Monitor debug labels for detailed signal information and validation
Signal Logic
- Buy signals are blocked when ATH increases to prevent buying at peaks
- Sell signals are blocked when ATL decreases to prevent selling at lows
- This ensures signals only trigger on subsequent bars, not the same bar that establishes new reference points
Buy Signals:
- Calculate drop percentage from ATH to buy signal source
- Trigger when drop reaches threshold increments (10%, 20%, 30%, etc.)
- Always blocked on ATH bars to prevent buying at peaks
- Optional: Also blocked on up/outside bars when Gann filter enabled
Sell Signals:
- Calculate gain percentage from lowest low to sell signal source
- Trigger when gain reaches threshold increments (30%, 60%, 90%, etc.)
- Always blocked when ATL decreases to prevent selling at lows
- Optional: Also blocked on down bars when Gann filter enabled
Limitations
- Designed for trending markets; may generate many signals in sideways/ranging markets
- Requires sufficient price movement to be effective
- Not suitable for scalping or very short timeframes
Implementation Notes
- Signals use optimistic price sources (low for buys, high for sells), these can be configured to be more conservative
- Gann filter provides additional signal filtering based on bar types
- Debug information available in data window for real-time analysis
- Detailed labels on each signal show ATH, lowest low, buy level, sell level, and drop/gain percentages
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。