T.H.E. v2.2 Ghost — Strategy by m_needhamj

By m_needhamj

Performance Metrics

Description

Custom updated TRIGGER HAPPY ELITE for Ghost. Credits go to MelisFantasticMind for creating the initial versions & Brian_P for their updates.GHOST WEBHOOK SETUP:1. Right-click strategy name -> "Add Alert..."2. Select: "Order fills only"3. Webhook URL: Your Ghost webhook URL4. Message: {{strategy.order.alert_message}}5. RECREATE alert after ANY setting change!SLIPPAGE & COMMISSION:Set in Properties tab (gear icon), not in InputsRecommended: Slippage=3, Commission=$0.62/contractIMPORTANT: This strategy is designed for INTRADAY timeframes (1m–1H).Daily profit/loss limits will NOT function correctly on Daily or highertimeframes. The Breakeven + Trail exit method has a 1-bar lag betweenstop calculation and placement — this is inherent to Pine Script'sbar-close execution model and means backtest results for this methodmay be slightly optimistic vs live execution.WEBHOOK TIMING NOTE:strategy.exit() stop/limit orders are monitored in REAL-TIME byTradingView's alert engine, even with calc_on_every_tick=false.This means exit webhooks fire the INSTANT price crosses the SL/TPlevel, but the chart display only updates at the next bar close.This is normal TradingView behavior — the webhook timing is correct,the chart display just lags behind. There will always be a visualdelay of up to 1 bar between the webhook firing and the chartshowing the exit.strategy.close() exits (flatten, daily limits, RSI, time-based)only fire at bar close, so these are synchronized with the chart. BACKTEST DATE RANGE FILTER============================Due to limitations with TradingView on lower timeframes the backtest results can exceed the 9000 order limit. If this occurs enable the Backtest Date Range filter and set a date of 2 - 3 months including today as the end. This should allow for the strategy to continue to plot properly.This version addresses several issues that were found:Fix #1 — BE+Trail 1-Bar Lag (Documented)Added clear comments throughout the BE+Trail section explaining that high/low-based profit calculations and the resulting strategy.exit() stops have a 1-bar lag inherent to Pine's bar-close model. Also noted in the header that backtest results for this method may be slightly optimistic vs live.Fix #2 — Daily P&L Premature Triggers (Fixed)Split into two variables: daily_closed_pnl (closed trades only, used for limit checks) and daily_display_pnl (closed + open, shown on dashboard). This prevents intra-bar price swings and overnight gaps from prematurely triggering daily limits. Added a new "Limit P&L" row on the dashboard so you can see the closed-only figure that actually drives the limits.Fix #3 — Trailing Stop Dedicated SL (Fixed)Added a new input trail_sl_ticks ("Initial Stop Loss") in the Trailing Stop Settings group, with its own preset values (p_trail_sl). The trailing method now uses this instead of reusing the Fixed TP/SL p_sl value. The webhook SL price fields also updated to use p_trail_sl.Fix #4 — Ghost Marker Visual Clarity (Documented)Added comments above the ghost plotshape calls explaining the markers are plotted at the pivot bar for visual clarity but entries fire p_pivot bars later on confirmation.Fix #5 — Ghost Lookback History Guard (Fixed)Added has_enough_history = bar_index > ghost_lookback + p_pivot + 1 and applied it to both is_ghost_high and is_ghost_low, preventing unreliable signals on early chart bars.Fix #6 — Daily Limits Timeframe Guard (Fixed)Both hit_target and hit_loss now require timeframe.isintraday. On daily+ charts the limits are inert. Dashboard status shows "USE INTRADAY" when on a non-intraday chart.Fix #7 — Opposite Signal Single-Bar Reversal (Fixed)Restructured can_trade so that when exit_method == "Opposite Signal", the position_size == 0 requirement is waived. Added can_reverse_long / can_reverse_short flags so strategy.entry() fires directly into the opposite direction — Pine's pyramiding=0 auto-closes the current position and opens the new one in a single bar. Removed the now-redundant strategy.close() calls from Method 4.Fix #8 — barstate.isconfirmed Defense-in-Depth (Fixed)Added barstate.isconfirmed to the can_trade condition. Prevents edge cases if calc_on_every_tick were accidentally enabled.Fix #9 — Risk-Based Position Sizing (Added)New inputs: size_mode (Fixed / Risk-Based) and risk_per_trade ($). When Risk-Based, contracts are calculated as floor(risk$ / (active_sl_ticks × tick_value)) with a minimum of 1. The active_sl_ticks resolves dynamically based on the current exit method. Dashboard shows the sizing mode and computed quantity.Fix #10 — Preset Override Tooltips (Improved)Inputs that are overridden by presets are now labelled [Custom only] in their names, with updated tooltips noting they're ignored when a preset is active.Dashboard UpdatesTable expanded from 19 to 21 rows to accommodate the new "Sizing" and "Limit P&L" rows. The TP/SL row now shows method-specific info instead of always showing Fixed TP/SL values.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView