[3Commas] Trail Hunter - Indicator Trail Hunter - Indicator
🔷 What it does:
This indicator visualizes a long-only mean-reversion signal framework on liquid instruments. It marks dual-confluence entry signals (MA cross-under + CCI oversold), tracks a virtual deal lifecycle on the chart with trailing take-profit and hard stop loss management, and exposes webhook-ready alerts for automated execution through an external DCA Bot. No orders are placed by the indicator itself — it is a pure signal and visualization layer.
Base Order signal: SMA(24) crosses below SMA(31) on 1h (default) AND CCI(11) on 1h crosses below −80
Exit signal: trailing take-profit activated at +1.5% with 0.05% trailing deviation, or hard stop at −3.25%
Single entry per cycle — no averaging, no safety order ladder
On-chart virtual P&L tracker: Net Profit, Max Drawdown, Trades, Win Rate, Profit Factor
🔷 Who is it for:
Bot operators who need a visual confirmation layer for automated mean-reversion execution.
Discretionary traders who use dual-indicator confluence logic manually and want clear on-chart triggers.
Free-tier TradingView users who want access to the same signal logic as the Strategy version without requiring backtest functionality.
Cross-instrument testers who run the same signal framework across crypto perpetuals, spot pairs, and equity tickers.
🔷 How does it work:
Long Entry: A long signal fires when two conditions align within a configurable keep-alive window — SMA(24) crosses below SMA(31) on the signal timeframe AND CCI(11) drops below −80 on the same timeframe. The indicator marks the entry with a green "L" triangle below the bar and stores the entry price as the reference for the trailing exit.
Short Entry: Not used — long-only signal framework by design.
Exit Management: Two exit conditions are armed simultaneously after entry. The trailing exit activates when price reaches Entry × (1 + Take Profit %), then follows the highest price reached with the deviation gap; if price retraces by the deviation amount from peak, the indicator marks the exit with a cyan diamond. The hard stop closes the virtual deal if price drops to Entry × (1 − Stop Loss %). Whichever condition fires first wins. The virtual P&L tracker captures the realized return at the actual fill price (peak − deviation for trail; SL price for stop).
🔷 Why it's unique:
Dual-indicator confluence — neither signal acts alone. The MA cross-under confirms short-term momentum exhaustion against the medium-term trend, and the CCI extreme confirms statistical oversold conditions. Requiring both filters out single-indicator false positives common to either condition during sideways regimes. Configurable keep-alive window (default 3 bars) lets the two confirmations align without requiring exact same-bar synchronization.
Trailing-exit architecture with full peak-tracking — the indicator computes the running peak from entry and triggers exit only when price retraces by the configured deviation from that peak. This is a true trailing simulation, not a fixed take-profit shortcut, and produces stats that match the underlying Strategy version closely.
Bot Integration — entry and exit alerts ship with webhook-ready JSON payloads, enabling direct trigger of a connected DCA Bot. Bot ID, Email Token, and pair label are exposed as inputs and automatically embedded into the alert message format.
🔷 What you'll see on the chart:
Cyan line — Fast MA on the signal timeframe (default SMA 24)
Orange line — Slow MA on the signal timeframe (default SMA 31)
Orange triangle (above bar) — MA cross-under signal fired
Cyan triangle (below bar) — CCI cross-under −80 signal fired
Green "L" triangle (below bar) — Combined entry signal armed; virtual deal opens
Cyan diamond — Trailing TP, fixed TP, or hard SL triggered; virtual deal closes
Cyan line (when in deal) — Entry price reference
Lime line (when in deal) — Trailing TP activation level
Red line (when in deal) — Stop Loss level
Stats card (top-left, configurable) — Live virtual backtest results: Net Profit, Max Drawdown, Total Trades, Win Rate, Profit Factor
🔷 Considerations Before Using the Indicator:
Market & Timeframe: Designed for 1-hour base charts on liquid instruments with frequent MA crossings — major crypto perpetuals (BTC, ETH, SOL), spot pairs on Coinbase and Bybit, and high-volume equities. The signal timeframe is independent of the chart timeframe — you can run on a 15m chart with 1h signals if you want fine-grained visualization with structural signal timing.
Limitations: The indicator does not place orders. It tracks a "virtual deal" state on the chart for visualization purposes only — actual execution must be performed through a connected bot or manually. This is a single-entry framework with no averaging, so a wrong entry caps at the −3.25% hard stop without recovery. The strategy carries no higher-timeframe regime filter, so it can signal long entries during sustained downtrends. For deployment in bearish regimes, consider gating the alerts manually with a higher-timeframe trend filter.
Virtual P&L Accuracy: The on-chart stats card uses a simplified internal accounting model — it does not factor exchange commission or slippage. The trailing exit simulation uses peak-tracking on the chart bar's high, which is an approximation of real intra-bar execution. Use the Strategy version for fee-adjusted backtest results.
Backtesting & Demo Testing: Always validate the signal framework on historical data before connecting to a live bot. The companion Strategy version of this script is available on the same profile for full backtest analysis with realistic commissions and slippage. Demo-trade for at least one month to observe behavior in conditions not represented in historical data. Past performance is not indicative of future results.
Parameter Adjustments: MA lengths, CCI threshold, signal timeframe, take-profit activation, trailing deviation, and stop loss should all be tuned per instrument volatility profile. Lower-volatility instruments work better with tighter MA pair, lower CCI threshold, and smaller trailing deviation. Higher-volatility instruments need wider parameters.
🔷 Backtest Validation:
This indicator shares identical signal logic with the Strategy version of the same framework, available on this profile for full historical performance review with realistic commission and slippage:
Strategy version:
Reference results from the Strategy version on COINBASE:BTCUSD, 1h chart, tested period May 12, 2025 — May 12, 2026:
Net Profit: +13.09 USD (+0.13%) | Max Drawdown: 7.91 USD (0.08%) | Total Trades: 66 | Win Rate: 69.70% (46/66) | Profit Factor: 1.254
The strategy is positioned as a capital-preservation framework — extreme drawdown control (under 0.1% on the tested window) with positive expectancy. Refer to the Strategy publication for the complete equity curve, trade-by-trade breakdown, and Strategy Tester report.
🔷 How to Use It:
🔸 Adjust Settings: Configure the MA lengths, CCI threshold, signal timeframe, and exit parameters for the instrument you intend to trade. Defaults are calibrated for 1-hour BTC Spot on Coinbase. For lower-volatility instruments, tighten the MA pair and lower the trailing deviation; for higher-volatility instruments, do the opposite. The Initial Capital input (default 10,000) is used only for percentage calculations in the stats card — it does not affect signal logic.
🔸 Visual Confirmation: Use the on-chart projections (entry line, TP activation, SL level) to verify that the active virtual deal aligns with your bot's actual position. The indicator's virtual deal state is a 1-to-1 mirror of the Strategy version's signal logic, so any divergence between chart visuals and bot position is a flag for investigation. The MA and CCI signal triangles let you trace exactly when each condition fired in the entry stack.
🔸 Create alerts to trigger the DCA Bot: Two alert events are exposed by the indicator — "Deal Start" fires on each new combined entry signal, and "Deal Close" fires when any of the three exit conditions (trailing TP, fixed TP, or stop loss) triggers. Configure both alerts in TradingView with the webhook URL pointing to your DCA Bot's signal endpoint. The Bot ID, Email Token, and Pair label can be set in the script's inputs and are automatically embedded into the alert JSON payload.
🔷 INDICATOR SETTINGS
MA Type — Moving average type for entry calculation (SMA or EMA).
Fast MA Length — Period of the fast moving average (default 24).
Slow MA Length — Period of the slow moving average (default 31).
MA Cross Timeframe — Timeframe on which the MA cross is computed.
Use MA Cross signal — Toggle the MA condition on or off in the entry stack.
CCI Length — Period for the CCI indicator (default 11).
CCI Oversold Threshold — Value below which CCI must cross to qualify as oversold (default −80).
CCI Timeframe — Timeframe on which the CCI cross is computed.
Use CCI signal — Toggle the CCI condition on or off.
Combine Signals — AND requires both conditions within the keep-alive window; OR fires on either alone.
Signal Keep-Alive (bars) — Number of bars within which both signals must align for AND mode (default 3).
Base Order Volume (USDT, ref) — Reference notional for virtual P&L calculation.
Take Profit % (activation) — Profit level at which the trailing exit arms.
Enable Trailing — Toggle trailing behavior on the take-profit exit.
Trailing Deviation % — Distance from the peak price at which the trailing exit fires.
Enable Stop Loss — Toggle the hard stop loss on or off.
Stop Loss % (from entry) — Maximum acceptable loss from entry price.
Initial Capital (ref for % calc) — Reference capital base for percentage metrics in the stats card.
Visual Layer toggles — Show/hide MA lines, entry line, TP/SL lines, signal triangles.
Stats card / Watermark — Display layer controls for on-chart virtual backtest summary and branding.
Webhook — Bot ID, Email Token, and Pair label for DCA Bot signal routing.
👨🏻💻💭 We hope this tool helps enhance your trading. Your feedback is invaluable, so feel free to share any suggestions for improvements or new features you'd like to see implemented.
__
The information and publications within the 3Commas TradingView account are not meant to be and do not constitute financial, investment, trading, or other types of advice or recommendations supplied or endorsed by 3Commas and any of the parties acting on behalf of 3Commas, including its employees, contractors, ambassadors, etc.
Wskaźnik Pine Script®






















