External Signals Strategy Tester v5 by RezzoRedPriest

By RezzoRedPriest

Performance Metrics

Description

May 2External Signals Strategy Tester v5 – User Guide (English)1. PurposeThis Pine Script strategy is a universal back‑tester that lets you plug in any external buy/sell series (for example, another indicator, webhook feed, or higher‑time‑frame condition) and evaluate a rich set of money‑management rules around it – with a single click on/off workflow for every module.2. Core WorkflowFeed signalsBuy Signal / Sell Signal inputs accept any series (price, boolean, output of request.security(), etc.).A crossover above 0 is treated as “signal fired”.Date filterStart Date / End Date restricts the test window so you can exclude unwanted history.Trade engineOptional Long / Short enable toggles.Choose whether opposite signals simply close the trade or reverse it (flip direction in one transaction).Risk modules – all opt‑in via check‑boxesClassic % block – fixed % Take‑Profit / Stop‑Loss / Break‑Even.Fibonacci Bollinger Bands (FBB) moduleDraws dynamic VWMA/HMA/SMA/EMA/DEMA/TEMA mid‑line with ATR‑scaled Fibonacci envelopes.Every line can be used for stops, trailing, or multi‑target exits.Separate LONG and SHORT sub‑modulesEach has its own SL plus three Take‑Profits (TP1‑TP3).Per TP you set line, position‑percentage to close, and an optional trailing flag.Executed TP/SLs deactivate themselves so they cannot refire.Trailing behaviourIf Trail is checked, the selected line is re‑evaluated once per bar; the order is amended via strategy.exit().3. Inputs OverviewGroup Parameter NotesTrade Settings Enable Long / Enable Short Master switchesClose on Opposite / Reverse Position How to react to a counter‑signalRisk % Use TP / SL / BE + their % Traditional fixed‑distance managementFibo Bands FIBO LEVELS ENABLE + visual style/length Turn indicator overlay on/offFBB LONG SL / TP1‑TP3 Enable, Line, %, Trail Rules applied only while a long is openFBB SHORT SL / TP1‑TP3 Enable, Line, %, Trail Rules applied only while a short is openLine choices: Basis, 0.236, 0.382, 0.5, 0.618, 0.764, 1.0 – long rules use lower bands, short rules use upper bands automatically.4. Algorithm DetailsPosition openOn the very first bar after entry, the script checks the direction and activates the corresponding LONG or SHORT module, deactivating the other.Order management loop (every bar)FBB Stop‑Loss: placed/updated at chosen band; if trailing, follows the new value.TP1‑TP3: each active target updates its limit price to the selected band (or holds static if trailing is off).The classic % block runs in parallel; its exits have priority because they call strategy.close_all().Exit handlingWhen any strategy.exit() fires, the script reads exit_id and flips the *_Active flag so that order will not be recreated.A Stop‑Loss (SL) also disables all remaining TPs for that leg.5. Typical Use CasesScenario Suggested SetupScalping longs into VWAP‐reversion Enable LONG TP1 @ 0.382 (30 %), TP2 @ 0.618 (40 %), SL @ 0.236 + trailingFade shorts during news spikes Enable SHORT SL @ 1.0 (no trail) and SHORT TP1,2,3 on consecutive lowers with small size‑outsClassic trend‑follow Use only classic % TP/SL block and disable FBB modules6. Hints & TipsSignal quality matters – this script manages exits, it does not generate entries.Keep TV time zone in mind when picking start/end dates.For portfolio‑style testing allocate smaller default_qty_value than 100 % or use strategy.percent_of_equity sizing.You can combine FBB exits with fixed‑% ones for layered management.7. Limitations / SafetyNo pyramiding; the script holds max one position at a time.All calculations are bar‑close; intra‑bar touches may differ from real‑time execution.The indicator overlay is optional, so you can run visual‑clean tests by unchecking FIBO LEVELS ENABLE.May 3Release NotesExternal Signals Strategy Tester v5A modular, click‑to‑configure strategy back‑tester for TradingView1. PurposeThis script turns any external signal or custom line crossover into a fully featured trading system with:Direction filters (enable Long / Short separately).Automatic or manual Stop‑Loss + 3 Take‑Profits (each with optional trailing).Dynamic exits driven by Fibonacci Bollinger Bands (FBB).Classic fixed‑percent TP / SL / Break‑Even block.Independent LONG and SHORT money‑management modules.All options are exposed as intuitive check‑boxes and dropdowns—no code edits required.2. How entries workMode Description Where to enableExternal series Choose Buy Signal / Sell Signal – any series (indicator plot, security(), etc.). A crossover above 0 triggers the entry. Top‑level inputsLine‑cross trigger Select Line Source (any plot/price) and crossing direction. Long Line Cross & Short Line Cross groupsBoth mechanisms are combined with OR logic—either one can open a trade. 3. Exit arsenalEach side (long/short) has its own module:Element OptionsStop‑Loss ✓ Enable · Side (Upper/Lower) · Level (Basis … 1.0) · ✓ Trail with separate side/levelTP1‑TP3 same controls + % Qty to closeBand side logic Upper selects the band above Basis, Lower the one below. Exactly matches visible lines.Trailing If checked, price re‑locks to the chosen band each bar; if off, price is fixed at entry.Self‑deactivation When a TP fires its flag flips off so it cannot execute again. An SL cancels remaining TPs.Classic % block (TP %, SL %, BE %) runs in parallel and, if triggered, uses strategy.close_all().4. Fibonacci Bollinger Bands overlayATR‑scaled envelopes around a configurable base line (VWMA / HMA / SMA / EMA / DEMA / TEMA).Levels: Basis, 0.236 … 1.0.View modes: Full (all lines), Cloud, Extremes.Completely optional—uncheck FIBO LEVELS ENABLE to hide visuals while using their prices internally.5. Input groups quick mapGroup Key fieldsDate Range Start / End timestampBuy / Sell Signal External series for entryLong / Short Line Cross ✓ Enable · Line Source · DirectionTrade Settings Enable Long / Short · Close‑on‑Opposite · Reverse PositionRisk % Use % TP / SL / BE + their percentagesFibo Bands Visual toggle & stylingFBB LONG / SHORT SL Enable · Side · Level · Trailing optionsFBB LONG / SHORT TP1‑TP3 ditto + % Qty6. Typical set‑upsScenario Suggested inputsIntraday trend follow Long Line Cross: price Below→Above VWAP; Long SL Lower 0.382 (trail); TP1‑3 on Upper bands; disable Short module.Mean‑reversion scalps External Buy/Sell from RSI divergence; both modules active; SL on opposite 1.0 band, no trailing; TP1 Upper/Lower 0.382 only.Classic fixed % Disable all FBB groups, keep Risk % block on.7. Execution details & limitationsOne position at a time – no scaling in (except partial exits via TP1‑3).Calculations are end‑of‑bar; intra‑bar touches aren’t simulated.Trailing updates once per bar – not tick‑by‑tick.Strategy quantity defaults to 100 % equity; adjust Position Size or switch sizing mode as needed.8. Changelogv7Added explicit Upper / Lower band selection for every SL / TP.Fixed/Trailing price logic—levels captured at entry, only updated when Trail is on.Retained all v6 features (generic line‑cross entry, separate long/short modules).Earlier versions: v6 (line‑cross entry), v5 (dual long/short modules), v4 (multi‑TP with trailing), v1‑3 initial builds.9. UsageLoad script on any symbol / timeframe.Open settings ⚙️.Toggle the modules you need, pick band sides/levels, hit OK.Scroll the chart or run strategy tester to inspect performance.May 4Release NotesExternal Signals Strategy Tester v7A back‑testing engine that manages positions opened by your own entry signals and closes them on dynamically‑calculated Fibonacci Bollinger Band levels.It is designed for strategy prototyping: you connect any indicator / alert to generate a buy‑ or sell‑pulse, then let this script handle position size, SL/TP logic and performance statistics.▸ How it Enters TradesExternal pulsesBuy Signal / Sell Signal inputs accept any series:1 (or true) on the bar → long / short entry next bar open.Optional line‑crossEnable Long Line Cross or Short Line Cross to enter when close crosses a custom source line (MA, VWAP, etc.).Date range filter – back‑test only the period you need.▸ Fibonacci Bollinger Bands (FBB)Combines a selectable basis (VWMA, HMA, SMA, EMA, DEMA, TEMA) with ATR‑scaled deviation.Seven Fibonacci levels per side (0.236 … 1.0) are plotted; you can pick any of them for SL/TP.View modes: Full / Cloud / Extremes to keep the chart clean.▸ Position ManagementComponent Setting BehaviourStop‑Loss Side + Level (+ optional trailing) Updates each bar if Trail SL is onTP1 (Trail‑enabled) Side + Level (+ optional trailing line) Trails every bar when enabledTP2 / TP3 (Fixed) Side + Level Price is fixed on the first bar after entryClose on Opposite / Reverse on Opposite — Either exit or flip the position on an opposite pulseClassic %‑Risk block TP %, SL %, BE % Percent‑based kill‑switches that work in parallel to FBB exits▸ Quick‑StartAdd your entry indicator to the same chart and pipe its boolean/binary output into Buy Signal / Sell Signal (or just paste a security‑call series).Choose position side(s) (Enable Long / Enable Short).Pick FBB levels for SL, TP1‑3.Turn Trail TP1 on if you want it to follow another FBB line; leave TP2/TP3 as simple targets.Press “Add to Chart” – the script will plot entries, exits, and a full TradingView Strategy Report.▸ Tips & NotesWorks on any symbol / timeframe; no repaint – all calculations use historical data only.If your entry signal fires inside the disabled Date Range, nothing happens.Sum of TP quantities should be ≤ 100 %.Trailing uses limit‑orders; if your market’s syminfo.mintick is large, TP1 may update in visible steps.The script itself does not generate entries – that is left to your indicators or the optional line‑cross.Happy testing and fine‑tuning!

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView