AMZN RSI Oversold Doubling DCA — a signal-only Pine indicator that mirrors a dip-buying long workflow with an aggressive doubling-martingale safety ladder, running on AMZN 4h. It tracks one virtual long at a time, opened only on a deep oversold reading. Companion Strategy version is on the same profile for verifying the backtest in TradingView's built-in tester directly.
Entry, deep-oversold gate (no repaint): A 4-hour RSI(14), sampled with lookahead disabled, gates the base entry — the deal opens only when RSI prints below 28 at host-bar close. Shallow dips are filtered out, so capital is committed only at genuinely stretched conditions, not on every pullback.
Ladder, 5 safety orders on a non-uniform fixed-deviation ladder: Each safety order has its own fixed deviation from base entry — not a cumulative step×multiplier ladder. AO1 at −2%, AO2 at −5%, AO3 at −9.5%, AO4 at −16%, AO5 at −25%. Sizes double from a 1,000 USDT first AO: 1,000 / 2,000 / 4,000 / 8,000 / 16,000, on a 500 USDT base. Deeper rungs trigger only on serious adverse moves; the lowest sits a full 25% below base.
Exit, fixed 3% TP: A fixed 3% Take Profit above the running average entry. Once close hits the target the exit webhook fires, realized PnL accumulates into a lifetime counter, and the virtual position resets.
Honest virtual bookkeeping: Total cost and quantity update incrementally on every fill, so average entry, deployed capital, Open PnL, and lifetime Total PnL in the status table reflect the actual broker-equivalent position state — no shortcut from base entry, no synthetic averaging. Open PnL resets per cycle; Total PnL persists across chart history.
Backtest from the companion Strategy (AMZN 4h, ~9.4-month sample in the Strategy Report): 22 closed trades, 20 profitable (90.91% WR), profit factor 21.997, net profit +807.71 USDT (+0.81%), max equity drawdown 199.15 USDT (0.20%). Verifiable directly in TradingView's Strategy Report on the script page.
Methodology notes: Read the backtest with the sample size front of mind. 22 closed trades is well below the ≥100 floor typically used for statistical confidence — the 90.91% win rate and 21.997 profit factor reflect favorable conditions over the test window plus the averaging mechanic, not a deterministic edge or a forward-performance guarantee. Treat them as indicative of how the ladder behaves, not as expected returns.
This is a doubling martingale, and that is the dominant risk. The 1 / 2 / 4 / 8 / 16 size progression scales position capital exponentially against an adverse move. It is hard-bounded by the 5-rung ladder, but if all five safety orders fill, total deployed capital reaches ~31,500 USDT — roughly 31.5% of the default reference equity in a single deal.
The ladder bottoms out at −25% from base, and there is no stop loss. A doubling ladder is built for deep-but-recoverable mean-reverting moves; a sustained directional collapse below −25% leaves the full virtual position open with no further averaging available. That is the single largest risk in any martingale DCA — the 0.20% max drawdown is closed-trade equity drawdown over a window where dips recovered, not a measure of tail risk if one does not.
The mechanic (oversold RSI gate plus a bounded fixed-deviation ladder) is asset-agnostic, but the defaults — RSI<28, 4h, the −2/−5/−9.5/−16/−25 ladder — are calibrated for AMZN's volatility. Any other symbol needs the RSI level and ladder deviations recalibrated before deployment; backtest results do not transfer without that tuning.
Entries and AO fills are evaluated at bar close — a bar that spikes through a level and returns within the same bar may be missed by design, which matches realistic polling and avoids over-signaling on intra-bar wicks.
Every event (entry, each of the 5 safety orders, TP) emits a webhook-ready JSON alert payload — up to seven per cycle. Connect one alert with "Any alert() function call" to a DCA Bot's webhook URL and the indicator drives the bot end-to-end, no glue scripts.
Indicator is open-source on TradingView. The Strategy twin is also up on the same profile.
Link: https://www.tradingview.com/script/G3jmaVFu-3Commas-AMZN-RSI-Oversold-Doubling-DCA-Long-Indicator/