Cival Trapped Traders — Platform Compatibility
The ATAS plugin is the reference implementation. Each port computes what its platform's data allows and labels
anything approximate or unavailable inside the indicator itself. The sections below are the READMEs that ship next
to each port's source file (ports/<platform>/README.md).
TradingView (Pine Script v6)
Cival Trapped Traders for TradingView (Pine Script v6)
Port of the ATAS original Cival Trapped Traders v1.2.1. It maps closed-bar failed-aggression hypotheses: directional executed volume outside a known structural reference (source, "at risk"), a later close back through that reference ("reclaimed"), a still-later qualifying displacement ("confirmed"), and the observed aftermath (rejected retest, invalidation, expiry). It never infers positions, identities, stops or exits, and the 0-100 evidence points are a checklist, not a probability. Nothing here trades or sends orders.
Requirements
- TradingView Premium or Ultimate plan. The detector is built on
request.footprint(), which returnsnaon lower plans. This mirrors ATAS, where the source rule makes footprint mandatory: without footprint data the source detector is OFF and the dashboard says so. There is no price-only or lower-timeframe substitute for the source rule, because per-price-row aggression, diagonal imbalances and candle-extreme rows cannot be reconstructed from bars. - A symbol and timeframe for which TradingView can build a volume footprint (history depth varies by plan and timeframe). Use standard candles/bars.
- File:
CivalTrappedTraders.pine, overlay indicator, Pine v6.
Install
- Open the Pine Editor on TradingView, choose Open > New blank indicator, paste the contents of
CivalTrappedTraders.pine, click Save, then Add to chart. - Leave Apply a starting preset on
Custom(identical to Balanced at default values) or pick Balanced / Selective / Responsive. - Alerts are off by default. To use them: turn on Enable new live local alerts, then create a TradingView alert on this indicator with condition Any alert() function call. Alerts fire only on live bar closes, never for history.
- If TradingView reports a runtime/time-limit error on instruments with thousands of ticks per bar, raise Footprint ticks per row (group
98 TradingView data) or lower Maximum chart slots at rebuild.
Feature matrix
Values: Full / Approximate / Not available / Not ported.
| Feature | ATAS original | This port | Notes |
|---|---|---|---|
| Failed-breakout source (aggression beyond a known boundary after a strict breakout) | Yes | Approximate | Same rules and thresholds; data comes from TradingView footprint rows (aggregated by ticks per row, default 1) instead of ATAS per-price bid/ask levels. |
| Extreme-aggression rejection source | Yes | Approximate | Same as above; extreme region = outer fraction of the candle range. |
| Stranded diagonal-stack source | Yes | Approximate | Diagonal ratio computed by the script from adjacent rows (not TradingView's has_buy_imbalance), so the ratio setting means exactly "aggressor volume >= ratio x opposite volume one row away". |
| Structural reference: prior range / confirmed swings / manual levels | Yes | Full | Source candle is excluded from its reference; pivots usable only after right-hand confirmation. |
| Prior ATR, prior-volume baseline and RVOL gate | Yes | Full | Frozen at the source; uses the chart's volume. |
| Ambiguous-path guard (both boundaries crossed in one candle) | Yes | Full | Emits an "ambiguous" marker, creates no source. |
| Footprint mandatory; unavailable-data status | Yes | Full | Dashboard row DATA: states footprint on/off and the reason when a bar is rejected. |
| Footprint reconciliation checks | Yes | Approximate | Candle-level only: positive volume, row budget, footprint total vs chart volume within tolerance, buy+sell coverage. Per-row duplicate/off-grid checks are not needed (TradingView supplies aggregated rows). A symbol whose chart volume differs from its footprint total by more than the tolerance is reported "Incomplete volume/classification reconciliation" rather than guessed. |
| Lifecycle: at risk, reclaimed, confirmed, retested | Yes | Full | No same-bar confirmation; minimum later bars; displacement, close-location and flow gates. |
| Terminal outcomes: accepted, expired, filtered, invalidated, interrupted | Yes | Full | Invalidation takes precedence over guide touches. |
| Confirmation evidence policy (CompleteFootprint / OpposingDelta / PriceOnly) | Yes | Full | Delta comes from the reconciled footprint only. |
| Evidence points /100 (7 items) and minimum-evidence gate | Yes | Full | Unavailable evidence is not scored. Not a probability. |
| Frozen invalidation (tick/ATR offset, rounded outward; Close or Wick) | Yes | Full | |
| Rejected retest and 1R/2R reference observations | Yes | Full | Reference prices only; no fills or P&L. |
| Cooldown, overlap suppression, bounded retention (zones, candidates, events, rows) | Yes | Full | Same limits and eviction order. |
| Interruption on bad data or gaps | Yes | Approximate | Malformed OHLC/volume interrupts and resets baselines. Pine bars cannot skip ordinals and has no explicit source-gap flag, so those two ATAS triggers do not exist here. |
| Zone bands (solid confirmed, dashed candidate, fill opacity, extend to edge) | Yes | Approximate | Time-anchored boxes. Zone edges are +/- half a row around row prices (a half-tick offset from TradingView's own row edges). No minimum pixel height. |
| Faint historical source span | Yes | Full | |
| Observed aggression VWAP line | Yes | Approximate | Weighted by each row's representative price (see Known differences). |
| Top-32 observed source rows profile | Yes | Approximate | Drawn as horizontal boxes up to 6 bars wide beside the zone; capped by the 500-box budget. |
| Numeric labels (cycle, range, volume) | Yes | Approximate | Pine labels; no collision avoidance. |
| Confirmation marker and large trapped-side arrow | Yes | Full | Marker carries the Pine bar_index of confirmation. |
| Retest / invalidated / ambiguous event markers (newest 24) | Yes | Full | Hidden in compact mode, as in ATAS. |
| Selected-cycle invalidation line and optional 1R/2R guides | Yes | Approximate | Selected cycle = newest eligible one; ATAS can also pick by mouse position. |
| Dashboard with confluence checklist | Yes | Approximate | Pine table, four corners; no width control. Adds a TradingView DATA: row. |
| Trap cards (stacked per-trap cards) | Yes | Not ported | The labels and dashboard carry the same figures. |
| Live forming-bar preview (provisional gold overlay) | Yes | Not ported | Only closed-bar state is drawn. The dashboard's live line (adverse ticks from the current price, live delta) is marked "live, may change" and never feeds confirmed state. |
| Review "as of" bar | Yes | Approximate | Type a Pine bar_index; processing stops there. Does not hide later candles (same as ATAS). |
| Crosshair inspection, "set review at crosshair", "return to latest" buttons | Yes | Not available | Pine cannot read the crosshair or run action buttons. Use the bar-index input (-1 = latest). |
| Presets Balanced / Selective / Responsive | Yes | Approximate | While a preset is selected it overrides every computation input (ATAS applies it once as an action and leaves settings editable). Select Custom to edit. |
| Compact display / full analysis detail | Yes | Approximate | Compact hides ended zones and event markers and shows only pending/active cycles. The ATAS read-out badge and plain-language relabelling are not ported. |
| Opt-in alerts: confirmation, retest, invalidation | Yes | Full | Via alert(); live bar closes only; alert sound is chosen in TradingView's alert dialog. |
| Hidden numeric outputs for integrations | 16 series | Approximate | 2 of 16 ported (Buyers confirmed, Sellers confirmed), data-window only. |
| JSON and event-CSV export | Yes | Not available | Pine cannot write files. |
Settings mapping
Input names, groups and defaults are the ATAS ones (see the shared settings reference). Present in this port: 00 Quick setup, 00 Chart clarity, 01 Structure, 02 Source aggression, 03 Prior baselines, 04 Later confirmation, 05 Zone lifecycle, 70 Review (Review as of bar), 80 Data and limits, 89 Live visuals (extend boxes, arrows, confluence), 90 Display (all but the items below), 91 Colors, 95 Alerts (not the sound).
TradingView-only input: 98 TradingView data > Footprint ticks per row (default 1).
Not ported
| ATAS setting | Reason |
|---|---|
| Dashboard width | Pine tables size to their text. |
| Inspect crosshair cycle | No crosshair access. |
| Minimum visible box height pixels | Pine boxes have no pixel minimum. |
| Show live forming trap preview, Live preview refresh milliseconds | Live preview layer not ported. |
| Show trap cards with volume and price | Cards not ported. |
| Apply upgraded visual defaults now | Action button. |
| Set review at completed crosshair now, Return to latest study now | Action buttons; use the Review input. |
| Alert sound | Chosen in TradingView's alert dialog. |
| Export folder, Export current JSON and event CSV now | No file I/O in Pine. |
Known differences from ATAS results
- Row prices. ATAS reads one bid/ask row per traded price. TradingView returns rows of ticks per row ticks with an upper and lower edge. The script uses each row's lowest tradable tick as its price (
down_price + max(0, up_price - down_price - mintick) / 2), which equals the ATAS price at 1 tick per row. This convention is an assumption and has not been checked against live TradingView data. At more than 1 tick per row, stacks and imbalances compare rows of that size, so results diverge from ATAS. - Footprint availability. TradingView footprint history depth, symbols covered and chart-volume agreement differ from an ATAS feed. Bars without reconcilable footprint count as "unavailable"; sources cannot form on them.
- Visible zones. ATAS limits to cycles in the scrolled viewport; Pine cannot read the viewport, so "Maximum recent visible zones" keeps the newest N overall.
- Review mode uses TradingView
bar_index, not ATAS ordinals, so the same number points at a different bar. - Drawing caps. Boxes (460 budget), lines and labels are capped by TradingView at 500 each; very busy charts drop the oldest profile bars first.
- Runtime. Row scanning runs only on bars where a detector can possibly fire, but wide-range bars at 1 tick per row can be slow on TradingView. Raise ticks per row if needed.
Verification status
Compiled with TradingView's Pine compiler (pine_check) on 2026-10-26: compiled: true, 0 errors, 0 warnings. Not run on a live chart or in replay. Footprint row conventions, history depth, the runtime on real symbols, alert delivery and drawing appearance are unverified. No claim of profitability, accuracy or vendor parity is made.
NinjaTrader 8 (NinjaScript)
Cival Trapped Traders - NinjaTrader 8
Port of the ATAS original v1.2.1 (Cival.TrappedTraders). Closed-bar failed-aggression study: directional aggression at a known structural reference, a later reclaim and a later qualifying confirmation, followed through to retest, invalidation, expiry or interruption. "Confirmed" means this study's failed-aggression criteria were met on a closed bar. It does not say anything about traders' actual positions, size, entry price or exits, which the study never sees. Evidence points are a checklist out of 100, not a probability. No orders, no account access, no network access.
Requirements
| Item | Requirement |
|---|---|
| Platform | NinjaTrader 8 (NinjaScript, .NET Framework 4.8). |
| Bar type | Order Flow+ Volumetric bars. Footprint detections need real per-price bid/ask volume, so the chart must use Volumetric bars with Ticks per level = 1 (the original works per tick) and delta type Bid/Ask. |
| License | An Order Flow+ entitlement (Volumetric bars) and a data feed that supplies tick-level bid/ask history and real-time data. |
| Calculation | Calculate must stay On bar close. Any other setting is refused and the HUD says so. |
| Not volumetric | On any other bar type the study loads, runs its price-only baselines, and shows "Footprint source OFF". It does not invent footprint rows and it produces no trap candidates. |
| Compile status | Not compiled. NinjaTrader is not installed on the machine where this port was written, so the source has never been through the NinjaScript compiler. Compile on import: NinjaScript Editor -> F5. Please report any compiler message verbatim. |
Install
- Close any open NinjaScript Editor windows.
- Copy
CivalTrappedTraders.cstoDocuments\NinjaTrader 8\bin\Custom\Indicators\. - In NinjaTrader choose New -> NinjaScript Editor, open the file, and press F5 to compile. If the compiler reports an error, keep the exact message.
- Open a chart with an Order Flow+ Volumetric series (Ticks per level 1), then right-click -> Indicators -> add Cival Trapped Traders.
- Start with the defaults (they match the ATAS "Balanced" preset). Allow at least 21 completed bars of footprint history.
Colours: rose = buyers failed (bearish response), teal = sellers failed (bullish response), gold = at risk / unconfirmed.
What is detected
Same rule set as the ATAS original (see its README for the full text):
- Failed breakout - aggressive volume outside a prior range, confirmed swing, or manual reference after a strict price breakout.
- Edge rejection - directional extreme-row aggression at a known boundary that the source candle already rejects.
- Stack failure - consecutive diagonal imbalances (aggressor volume >= ratio x opposite volume one tick away) that fail to hold their source region.
- Lifecycle - at risk -> reclaimed -> confirmed -> rejected retest, with accepted, filtered, expired, invalidated and interrupted as explicit outcomes. A confirmation can never happen on the source bar.
- Data checks - every source needs reconciled rows (row volume within tolerance of candle volume, classified bid+ask >= the configured coverage). Missing or inconsistent rows make the footprint "unavailable" for that bar; nothing is filled in.
Feature matrix
Values: Full = same rule set and thresholds; Approximate = same idea, platform-specific difference described; Not available = the platform cannot supply it; Not ported = not implemented.
| Feature | ATAS original | This port | Notes |
|---|---|---|---|
| Failed breakout source | Yes | Full | Rows come from Volumetric bars. |
| Edge rejection source | Yes | Full | |
| Stack failure source (diagonal stacks) | Yes | Full | Needs tick-adjacent rows (Ticks per level 1). If rows are not tick-adjacent the bar is marked "footprint off" rather than approximated. |
| Reference modes (prior range / confirmed swings / manual) | Yes | Full | |
| ATR and RVOL baselines (prior bars only, frozen per source) | Yes | Full | |
| Footprint reconciliation (volume tolerance, classification coverage, row budget) | Yes | Full | The row budget counts the bar's price span in ticks (including empty ticks), not only traded rows. |
| Lifecycle states (at risk, reclaimed, confirmed, retested, invalidated, accepted, expired, filtered, interrupted) | Yes | Full | |
| Closed-bar confirmation, no repainting | Yes | Full | Calculate.OnBarClose; the forming bar is never read. |
| Evidence points /100 (7 checks) | Yes | Full | Not a probability. |
| Cooldown, overlap suppression, capacity limits | Yes | Full | |
| Invalidation (close or wick), ATR + tick buffer, outward tick rounding | Yes | Full | |
| Analytical 1R / 2R guide observations | Yes | Full | Reference prices only. No order, fill or P&L. |
| Ambiguous-candle handling (both boundaries crossed) | Yes | Full | Emits an "ambiguous" event; no source is created. |
| Malformed bar quarantine / baseline reset | Yes | Full | |
| Ordinal-gap interruption | Yes | Approximate | NinjaTrader delivers every bar index in order, so the ATAS ordinal-gap case cannot occur; malformed bars still interrupt. |
| Presets (Balanced / Selective / Responsive) | One-shot action | Approximate | An enum, not an action: a non-Custom value replaces all computation settings with that preset when the indicator loads. Leave on Custom to use your own values. |
| Trap zone boxes | Pixel-space boxes, dashed when unconfirmed | Approximate | Drawn with Draw.Rectangle in bar/price units. No dashed style, no minimum pixel height, and active zones extend to the last closed bar rather than the chart edge. |
| Aggression VWAP line | Yes | Full | |
| Top 32 observed source rows | Right of the zone, pixel scaled | Approximate | Short Draw.Line bars to the left of the source candle, length scaled to at most 5 bars. |
| Numeric labels, confirmation markers, directional arrows | Yes | Approximate | Draw.Text / Draw.ArrowUp / Draw.ArrowDown / Draw.Dot. No label collision handling. |
| Retest / invalidation / ambiguous markers | Yes | Approximate | Last 24, as in the original. |
| Selected-cycle invalidation and optional 1R / 2R lines | Mouse-selected cycle | Approximate | The newest selected cycle is used; there is no crosshair selection. |
| Dashboard HUD | Floating panel, width setting | Approximate | One Draw.TextFixed block. Corner is supported; width is not. |
| Trap cards | Floating cards | Approximate | A text block under the HUD for up to three cycles. |
| Confluence checklist (YES / WAIT / N/A) | Yes | Full | Text lines in the HUD. |
| Live forming-bar preview (gold LIVE overlay, live adverse ticks, live delta) | Yes | Not ported | The port is strictly closed-bar. The HUD shows the adverse distance from the aggression VWAP as of the last closed bar instead. |
| Inspect crosshair cycle | Yes | Not ported | No crosshair-to-bar access in a closed-bar study. |
| Review as of bar | Yes | Approximate | Review as of bar works (later bars are ignored). The crosshair and "return to latest" actions are not ported: set the value to -1 instead. |
| Alerts (confirmation, retest, invalidation) | Local, off by default, history suppressed | Full | Alert() in real-time only; off by default. Alert sound is a file name under <NinjaTrader install>\sounds (default alert1 -> alert1.wav). If the file is missing the alert is silent. |
| JSON + event CSV export | Action button, atomic files | Approximate | Same schema id (cival.trappedtraders.v1) and a hand-written JSON writer. NinjaTrader has no action buttons, so Export current JSON and event CSV now is a switch: when on, a snapshot is written once after history loads and again whenever the event list changes in real time. Default folder Documents\NinjaTrader 8\CivalTrappedTraders. |
| 16 hidden integration outputs | Hidden series | Full | Public non-plotted Series<double> properties (NetConfirmed, BuyersConfirmed, ... InvalidationCount), same values and order. |
| Chart clarity compact display | Yes | Approximate | Only the compact/full switch is ported (hides ended zones, trap cards and event markers). The clarity banner is not ported. |
| Bounded history window | Yes | Full | Starts Maximum chart slots at rebuild bars before the last loaded bar. |
Settings mapping
All 77 ported inputs keep the ATAS display names, group names and defaults (taken from the compiled settings dump). Groups: 00 Chart clarity, 00 Quick setup, 01 Structure, 02 Source aggression, 03 Prior baselines, 04 Later confirmation, 05 Zone lifecycle, 70 Review, 80 Data and limits, 89 Live visuals, 90 Display, 91 Colors, 95 Alerts, 99 Export. Decimal settings are double, colours are NinjaTrader brushes.
Not ported (not present as inputs):
| ATAS setting | Reason |
|---|---|
| Show live forming trap preview | Needs forming-bar footprint; the port is closed-bar only. |
| Live preview refresh milliseconds | Same. |
| Inspect crosshair cycle | No crosshair access. |
| Set review at completed crosshair now | Action button / crosshair access. Use Review as of bar. |
| Return to latest study now | Action button. Set Review as of bar to -1. |
| Dashboard width | Draw.TextFixed has no width control. |
| Minimum visible box height pixels | Boxes are drawn in bar/price units. |
| Apply upgraded visual defaults now | Action button; the defaults already enable those layers. |
Known differences from ATAS
- Different data. The rules are the same, but the rows come from NinjaTrader Volumetric bars instead of ATAS price levels. Feed, tick history and bid/ask classification differ between platforms, so the same market can produce different rows and therefore different candidates. Bar timestamps are NinjaTrader's (bar close time for time-based bars); ATAS used bar open time. Exports record the NinjaTrader timestamp and make no time-zone conversion.
- Arithmetic. The ATAS engine used
decimal; this port usesdoublewith a one-thousandth-of-a-tick tolerance on price comparisons so grid-exact ties behave the same. - Volumetric delta type. With delta type "Up/Down tick" instead of "Bid/Ask", NinjaTrader classifies volume differently and results will differ from a Bid/Ask chart.
- Ticks per level above 1 is refused rather than approximated (see the stack failure row).
- Real-time only alerts. NinjaTrader raises
Alert()only in real-time, which matches the original's rule that history never alerts. - Reloading. Changing any input reloads the indicator and recomputes from the bounded history window, as the ATAS settings changes did.
Verification status
Done offline against stand-ins for the NinjaTrader API, because NinjaTrader is not installed here:
- The engine was run side by side with the ATAS
TrapEngineon 96 seeded synthetic footprint scenarios (1,713 zones, 7,131 events, all three source kinds and all lifecycle states). Zones, events, evidence and the 16 output values matched within 1e-7. - The indicator was driven through load, history and real-time bars against API stand-ins, including exports (JSON parsed successfully).
- The source was syntax- and type-checked as C# 7.3 against .NET Framework reference assemblies.
Not verified: compilation against the real NinjaTrader assemblies, behaviour on a live chart, Volumetric API behaviour on real data, and appearance of the drawings. The scenarios are synthetic; they say nothing about market behaviour and this study makes no claim of profitability or accuracy.