OPEN-SOURCE SCRIPT

[3Commas] SOL RSI Reversal DCA - Short Indicator

330
[3Commas] SOL RSI Reversal DCA - Short Indicator

🔷 What it does:
This is a signal-only indicator that mirrors a short-side mean-reversion workflow on SOL / USDT. It tracks one virtual short position at a time, opened when the 3-minute RSI(9) crosses down through 80 (overbought momentum rollover). Up to three averaging orders fill at fixed deviations ABOVE base entry (+1%, +2%, +3%) with uniform sizing. Exit is a 1.3% Take Profit with a 0.3% trailing retrace, plus a hard 8% Stop Loss. The indicator computes running average entry, deployed capital, open PnL, and lifetime realized PnL — all from honest fill-by-fill bookkeeping. Every event emits a webhook-ready JSON alert payload for direct DCA Bot consumption.
- Momentum-exhaustion trigger: 3m RSI(9) crossing DOWN through 80.
- Uniform DCA ladder: +1% / +2% / +3% above base entry, equal sizing.
- Tight 1.3% Take Profit with a 0.3% trailing lock, and a hard 8% Stop Loss.
- Honest virtual bookkeeping: Open PnL and lifetime Total PnL displayed live on the chart.

🔷 Who is it for:
- Intraday traders fading overbought spikes on SOL on lower timeframes.
- Bot operators who want a chart-driven signal source that emits per-event JSON ready for a DCA Bot.
- Traders who want a defined-risk short signal — modest averaging plus a hard stop — rather than an open-ended martingale.
- Operators tracking staged position management (entry, up to three averaging fills, single exit) directly on the chart without the strategy-tester overhead.

🔷 How does it work:
Entry Trigger: A 3-minute RSI(9) is sampled via request.security with lookahead disabled (no repaint). The base short opens when that RSI crosses DOWN through 80 — the prior 3m close was ≥ 80 and the current is below it, marking the moment overbought momentum rolls over.
Base Entry: When the trigger fires, the indicator marks a virtual short, captures the base entry price, and seeds the cost-basis ledger with the configured base order size (default 500 USDT).
Averaging Orders (Uniform DCA Ladder): After base fill, the indicator monitors price deviation above the base entry. Each averaging order has a fixed deviation — +1%, +2%, +3% — with uniform sizing (250 USDT each). Each fill updates the running cost-basis and dispatches its own webhook payload, raising the virtual average entry.
Honest Virtual Bookkeeping: Total cost and qty are updated incrementally on every event, so the avg entry, deployed capital, Open PnL, and Total PnL displayed in the status table reflect the actual broker-equivalent position state — no shortcut from base entry, no synthetic averaging.
Exit (TP + Trailing): A 1.3% Take Profit below the running average entry arms a trailing exit. Once price trades through the TP level, the indicator tracks the in-favor low and signals a close when price retraces 0.3% off that low.
Stop Loss: A hard 8% Stop Loss above the average entry. If price runs against the short past that level, the close webhook fires, realized PnL accumulates, and the virtual position resets.
Lifetime Total PnL: When a cycle closes, its realized PnL accumulates into a lifetime counter. The status table displays both Open PnL (current cycle, resets on exit) and Total PnL (lifetime, persists across chart history).

🔷 Why it's unique:
- Momentum-Exhaustion Trigger: Rather than signaling on any overbought reading, the short opens specifically on the RSI crossing DOWN through 80 — the rollover moment — filtering out signals that fire while momentum is still climbing.
- Defined-Risk DCA: A modest 3-rung uniform ladder AND an 8% hard stop, so the worst-case loss per cycle is bounded and known in advance.
- Trailing Take Profit: The 1.3% target arms a 0.3% trailing exit rather than a fixed limit — capturing the reversion snap and then riding any follow-through.
- Lifetime PnL Tracking: Open PnL and Total PnL are displayed live on the chart — strategy-tester-equivalent insight without running a backtest.
- Per-Event Webhook Ledger: Up to six discrete events per cycle (entry + 3 AO fills + TP or SL), each with its own JSON alert payload. One TradingView alert with "Any alert() function call" drives a DCA Bot end-to-end.

🔷 Considerations Before Using the Indicator:
Sample Size: The companion strategy's backtest produced 100 closed trades — at the commonly used floor for statistical relevance, not far above it. The win rate and profit factor reflect favorable conditions over the test window; treat them as indicative, not a forward-performance guarantee.
Lower-Timeframe Sensitivity: The trigger runs on a 3-minute RSI. Lower timeframes generate more signals but are more sensitive to noise and fees. Confirm trade frequency and fee drag fit your execution venue.
Stop Loss Discipline: The 8% Stop Loss is the defining risk control. With base plus three averaging orders, maximum deployed capital is ~1,250 USDT (12.5% of the default reference equity); an 8% stop on that bounds the worst-case loss to roughly 1% of equity. Keep the stop enabled — removing it converts this into an unbounded martingale short.
Trend Risk: Fading overbought conditions works best in ranges and choppy regimes. In a strong sustained uptrend the short can hit the 8% stop repeatedly. The RSI-crossing-down trigger reduces but does not eliminate this.
Cross Detection Granularity: Entries, AO fills, and exits are evaluated on bar close. A bar that spikes through a level and returns within the same bar may be missed by design — this matches realistic polling behavior and avoids over-signaling on intra-bar wicks.
Live vs Historical State: The virtual position state is rebuilt from chart history each time the indicator is recompiled. If added mid-deployment or if the live bot diverges (manual interventions, partial fills), the indicator state may not match the live bot. Toggle the indicator off and on to reset.
Backtesting Note: This is an indicator, not a strategy. There is no built-in P&L tester — but the live Total PnL counter gives a running approximation. For full metrics over a ~2.8-month sample (100 closed trades, 87.00% win rate, 2.11% max drawdown, profit factor 1.955, +2.08% net return), use the companion strategy version on identical parameters. Note: those metrics were generated with a 5m RSI trigger; this indicator defaults to a 3m RSI trigger, which will produce a different signal cadence.

🔷 How to Use It:
🔸 Add the indicator to a SOL / USDT chart (3m chart recommended to match the RSI trigger).
🔸 Review the RSI trigger level, the averaging-order count/deviation/size, the Take Profit, Trailing, and Stop Loss percentages. Defaults mirror the source DCA Bot configuration with the RSI moved to 3m.
🔸 Set Base Order Size and AO sizes to match your bot's configuration (the avg-entry display becomes meaningful when virtual sizing matches real sizing).
🔸 In the DCA Bot Webhook group, paste the Bot ID, Email Token, and Pair (QUOTE_BASE format, e.g., USDT_SOL).
🔸 Create an alert on the indicator with "Any alert() function call". Paste the DCA Bot's webhook URL into the alert's Webhook field. The indicator will emit JSON payloads for entry, each averaging order, and the TP/SL exit — formatted for direct DCA Bot consumption.

🔷 INDICATOR SETTINGS
Base Order Size (USDT): Virtual order size for the avg-entry / open-PnL computation.
Averaging Orders per Trade: Number of safety orders (default 3).
First AO Size (USDT): Virtual size of each averaging order (uniform by default).
Deviation to First AO (%) / Deviation Step Multiplier: Spacing of the AO ladder above base entry. Defaults to uniform +1% steps.
Order Size Multiplier: Per-rung size scaling (1.0 = uniform).
RSI Timeframe / Length / Crossing Down Level: The RSI(9) crossing-down trigger (default 3m).
Take Profit (%) / Trailing (%): TP distance below average entry and the trailing retrace that closes the position.
Stop Loss (%): Hard stop above average entry.
Active Window: Optional date filter — when ON, the indicator only fires signals between From and To dates.
DCA Bot Webhook: Bot ID, Email Token, and Pair fields injected into every alert payload.
Visualization: Toggle DCA Ladder, Avg / TP / SL plot lines, fill labels, signal triangles, status table.
Brand Watermark: Configurable text, position, size, and transparency.

👨🏻‍💻💭 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.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.