OPEN-SOURCE SCRIPT

SOL RSI DCA - Long Indicator

389
SOL RSI DCA - Long Indicator

🔷 What it does:
This is a signal-only indicator that mirrors a long-only DCA workflow on SOL. It tracks one virtual long position at a time, opened while higher-timeframe momentum is depressed, then averages the position down on a measured geometric price-deviation ladder with up to three averaging orders. The base entry arms whenever the 1-hour RSI(14) sits below a configurable level (default 44). Averaging is price-driven only — no extra momentum gate — matching the source bot configuration. Exit is a fixed Take Profit at 2.4% above average entry. Every event emits a webhook-ready JSON payload for a DCA Bot.
- HTF RSI entry gate: base order arms while 1h RSI(14) is below the threshold (Less Than condition).
- Geometric averaging ladder: deviations −2.50%, −5.75%, −9.98%; sizes 87.5, 109.4, 136.7 USDT on a 1.3× deviation step × 1.25× size step.
- Fixed Take Profit: 2.4% above running average entry, no trailing.
- Honest virtual bookkeeping: total cost and qty updated incrementally on every fill — avg entry, deployed capital, open PnL, and cumulative realized PnL displayed live.
- Five discrete events per cycle (entry + 3 AO fills + TP), each with its own webhook payload.

🔷 Who is it for:
- Swing traders running a DCA Bot on SOL who want systematic long exposure when momentum is soft, scaling in if the dip deepens.
- Bot operators who want a chart-driven signal source that emits per-event JSON ready for a DCA Bot.
- DCA-style traders who prefer a measured geometric ladder over an aggressive doubling schedule.
- Traders who want to monitor an evolving DCA position — base entry, owned AO levels, deployed capital, open PnL, realized PnL, live RSI reading — directly on the chart without the strategy-tester overhead.

🔷 How does it work:
Entry RSI Filter (HTF Oversold): A 1-hour RSI(14) is sampled via request.security with lookahead disabled (no repaint). The base order arms whenever this RSI is below the configured level (default 44). At host-bar close, if the indicator is flat, the virtual long position opens.
Averaging Order Ladder (Price-Driven): After the base fill, the indicator watches price deviation against the position. The k-th averaging order fires when close ≤ base entry × (1 − cumulative deviation). Cumulative deviation grows by the 1.3× step multiplier: 2.50%, 5.75%, 9.98%. Each averaging order's virtual size grows by the 1.25× size multiplier: 87.5, 109.4, 136.7 USDT. Averaging is gated by price only — no extra RSI condition, matching the source bot configuration.
Honest Virtual Bookkeeping: Total cost and qty are updated incrementally on every fill, so the avg entry, deployed capital, open PnL, and cumulative realized PnL displayed in the status table reflect the actual broker-equivalent position state — no shortcut from base entry, no synthetic averaging.
Exit: A fixed Take Profit at 2.4% above the running average entry. When close hits the TP target, the close webhook fires, the realized PnL accumulator banks the gain, and the virtual position resets.

🔷 Why it's unique:
- HTF RSI Entry Gate: The base order keys off a 1-hour RSI(14) rather than the chart timeframe, so entries are anchored to the higher-timeframe momentum picture instead of intrabar noise.
- Measured Geometric Ladder: A 1.3× deviation step paired with a 1.25× size step keeps the average entry compounding controlled — the position deepens gradually rather than ballooning, which keeps maximum deployment near 5% of equity.
- Fill-by-Fill Avg Entry: The orange avg-entry line is derived from running totals updated on every event — what you see is what the broker-equivalent position would actually have.
- Realized PnL Readout: The status table shows cumulative realized PnL banked across closed cycles, so the chart reflects how the workflow has performed over the visible history, not just the open position.
- Per-Event Webhook Ledger: Five distinct events per cycle, each with its own JSON alert payload. The indicator drives a DCA Bot end-to-end through a single TradingView alert.

🔷 Considerations Before Using the Indicator:
Market & Timeframe: Designed for liquid crypto pairs. Default thresholds are calibrated for BINANCE:SOLUSDT spot, with the RSI filter on 1h. Run on a 1h chart (or lower for finer averaging-order fills). Different pairs may need RSI level and deviation ladder tuning.
Entry Is a Level, Not a Cross: The base order uses a Less Than condition (RSI < 44), matching the source bot. After a Take Profit, if RSI is still below 44 the indicator can immediately reopen a new virtual deal. This produces more frequent re-entries than a cross-down trigger — intended behavior, but review it against your risk appetite.
Cross Detection Granularity: Entries and AO fills 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 the indicator is added mid-deployment or the live bot diverges from the signal stream (manual interventions, partial fills), the indicator state may not match the live bot. Toggle the indicator off and on to reset.
Capital Deployment: If all three averaging orders fill, the virtual position scales from 200 USDT base to ~534 USDT total. Match the indicator's per-order allocation to your bot's configuration to keep the avg-entry display honest.
No Stop Loss: There is no exit signal on adverse moves beyond the 3-AO ladder. Risk is structurally capped on the bot side by the bounded position-size ladder. If a hard exchange-side stop is required, configure it on the bot directly.
Strong Downtrends: Like any dip-buying setup, this is positioned for mean reversions, not waterfall declines. In a sustained downtrend the ladder fills out and the position holds underwater until price recovers to the 2.4% TP above average. The bounded ladder limits the size of that exposure, but underwater hold time can still extend.
Backtesting Note: This is an indicator, not a strategy. There is no built-in P&L tester. For performance metrics over a ~3.5-month sample (29 closed trades, 86.21% win rate, 0.63% max drawdown, profit factor 22.256, +0.83% net return), use the companion strategy version on identical parameters. The 29-trade sample is well below the typical ≥100 floor for statistical confidence, and the high-win/low-frequency profile rests on a fixed 2.4% TP being hit most of the time — re-run on a 12+ month window for a more robust validation before drawing firm conclusions.

🔷 How to Use It:
🔸 Add the indicator to a 1h chart on the crypto pair you want to trade.
🔸 Review the entry RSI filter (timeframe / length / level), the 3-AO ladder parameters, and the Take Profit percentage. Defaults are calibrated for SOLUSDT 1h — recalibrate per asset before deploying.
🔸 Set Base Order Size and AO sizes to match your bot's configuration (the indicator's 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 TP 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: Maximum number of averaging orders per cycle (default 3).
First AO Size (USDT): Virtual size of the first averaging order; subsequent AOs scale by the Size Multiplier.
Deviation to First AO (%): Distance from base entry at which AO1 becomes eligible.
Deviation Step Multiplier: Ladder factor that widens each subsequent deviation step.
Order Size Multiplier: Factor that grows each subsequent averaging order's USDT size.
Entry RSI Timeframe / Length / Level: Higher-timeframe RSI filter that arms the base entry (Less Than condition).
Take Profit (%): Fixed distance above the running average entry where the virtual long closes.
DCA Bot Webhook: Bot ID, Email Token, and Pair fields injected into every alert payload.
Visualization: Toggle AO Ladder, Avg / TP plot lines, fill labels, signal triangles, status table (including cumulative realized PnL).
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.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.