OPEN-SOURCE SCRIPT

Heikin Ashi RSI Fade - Short Indicator

6 437
Heikin Ashi RSI Fade — Short Indicator

🔷 What it does:
This is a signal-only indicator that mirrors a fade-the-strength short workflow. It tracks one virtual short position at a time and fires webhook-ready alerts on three discrete events: a short entry confirmed by dual filters across two timeframes, a take-profit close when price drops a fixed percentage below entry, and a stop-loss close when price rises a fixed percentage above entry. No backtest engine — the indicator is built to drive a live DCA Bot directly through TradingView alerts.
- Dual confirmation entry: RSI(100) on 1h above 46 AND a configurable number of consecutive bullish Heikin Ashi candles on 15m.
- Fixed exits: TP at −2.1% from entry, SL at +2.5%. No trailing.
- Every event emits a fully-formed JSON payload ready for direct DCA Bot consumption.
- Status table tracks the live virtual state on every bar close.

🔷 Who is it for:
- Swing traders running a DCA Bot on crypto pairs that frequently overrun local resistance.
- Bot operators who want a chart-driven signal source that emits webhook JSON natively, with no glue scripts required.
- Traders who want to monitor entry, TP, and SL conditions in real time on the chart without the strategy-tester overhead.
- Risk-conscious operators looking for a clean fade engine with bounded per-trade exposure.

🔷 How does it work:
RSI Bias Filter: A long-window RSI(100) is sampled from the 1-hour timeframe via request.security. The threshold (default 46) sits just below the midline, so the filter is satisfied during prolonged bullish drift — exactly the regime where fading strength has the highest expectancy. When RSI falls below 46, the bias is considered to have flipped bearish and the indicator stops looking for new short signals.
Heikin Ashi Streak Trigger: A 15-minute Heikin Ashi stream is sampled in parallel, and the indicator counts consecutive same-direction HA candles using ta.barssince inside request.security. When the bullish streak reaches the configured length (default 7), the trigger is armed. A single input flips the HA direction between Bullish (fade strength, default) and Bearish (follow trend).
Virtual Position Tracking: When both filters align at host-bar close, the indicator marks a virtual short entry, captures the entry price, and pre-computes the TP and SL levels from the configured percentages. The position state, target prices, and live RSI / HA filter readouts are surfaced in the status table on every bar.
Close-Based Exit Detection: Exit signals are evaluated on bar close — when the close drops to the TP level, the TP event fires; when the close rises to the SL level, the SL event fires. This matches what a polling bot would see at each candle close and avoids over-signaling on intra-bar wicks.
Webhook Dispatch: Every event (entry, TP, SL) emits a dedicated JSON payload through alert(). One TradingView alert configured for "Any alert() function call" drives a DCA Bot end-to-end through the indicator's lifetime.

🔷 Why it's unique:
- Dual-Timeframe Confirmation: RSI on 1h filters macro bias, Heikin Ashi on 15m times the entry. The two conditions operate on different scales so they cannot be satisfied by the same noise pattern — every entry requires alignment across both.
- Fade-or-Follow Switch: A single input flips the HA direction filter between Bullish (fade strength, default) and Bearish (follow trend). The same engine handles two opposing setup archetypes.
- Honest Virtual State: Entry price, TP target, SL level, and live filter readouts are all surfaced on the chart in real time. No hidden math, no shortcut from a synthetic base — what you see is what the bot would see.
- DCA Bot Integration: Webhook payloads are identical to the companion strategy version, so the same bot configuration drives both. Use the indicator for live signals and the strategy for backtest validation.

🔷 Considerations Before Using the Indicator:
Market Selection: Designed for liquid crypto pairs that respect mean-reversion behavior on 1h–2h ranges. Strongly trending markets will repeatedly stop the indicator out; the 1h RSI(100) > 46 filter limits exposure to confirmed bullish drift, but a regime shift to a stronger trend requires manual oversight.
Cross-Detection Granularity: The indicator evaluates entries and exits on bar close. A bar that spikes through a TP or SL level intra-bar and returns within the same bar will not fire the event by design — this matches realistic polling behavior and avoids over-signaling on wicks.
Live vs Historical State: The virtual position state is rebuilt from chart history each time the indicator is recompiled or reloaded. 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.
No Stop Loss on the Bot Side: The indicator fires a close webhook when its virtual SL level is reached, but the underlying bot still relies on the indicator being live and the webhook being delivered. If hard exchange-side risk protection is required, configure a parallel SL on the exchange directly.
Backtesting Note: This is an indicator, not a strategy. There is no built-in P&L tester. For performance metrics over a five-year sample (~349 closed trades, 0.47% max drawdown, profit factor 1.117), use the companion strategy version on identical parameters.

🔷 How to Use It:
🔸 Add the indicator to a 1H or 2H crypto chart on the pair you want to trade.
🔸 Review the RSI filter (timeframe / length / condition / level) and the Heikin Ashi filter (timeframe / streak / direction). Defaults are calibrated for XRPUSDT — recalibrate per asset before deploying.
🔸 Set the Take Profit and Stop Loss percentages to match the volatility profile of your asset.
🔸 In the DCA Bot Webhook group, paste the Bot ID, Email Token, and Pair (QUOTE_BASE format, e.g., USDT_XRP).
🔸 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 short entry, TP close, and SL close — formatted for direct DCA Bot consumption.

🔷 INDICATOR SETTINGS
Base Order Size (USDT): Virtual order size, used only for the status-table display.
RSI Timeframe / Length / Condition / Level: Lower-timeframe RSI bias filter on the host symbol.
HA Timeframe / Streak / Direction: Heikin Ashi consecutive-candle trigger on the lower timeframe. Direction defines fade (Bullish) vs follow (Bearish) mode.
Take Profit (%) / Stop Loss (%): Fixed distance exits from the entry price.
DCA Bot Webhook: Bot ID, Email Token, and Pair fields injected into every alert payload.
Visualization: Toggle Avg Entry / 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.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.