Cival Pattern Lab — 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 Pattern Lab for TradingView

Port of the ATAS original Cival Pattern Lab v1.0.0.0 to Pine Script v6 (CivalPatternLab.pine).

Pattern Lab is a research tool, not a signal service. It evaluates one of six transparent, rule-based candle/order-flow patterns on closed bars, then reports a deliberately conservative simulation of those signals (next-bar-open entry, stop and target in ticks, maximum holding time, round-trip cost, stop-first on ambiguous bars) split into train / validation / untouched-test partitions by date. Results are observed history under the stated rules, not a calibrated probability, and no setting here has been shown to have an edge. The script is an indicator(), not a strategy(): it places no orders, makes no network calls and sends nothing off the chart.

Requirements

Item Requirement
Platform TradingView, Pine Script v6
Footprint data (real buy/sell volume per bar, POC) Premium or Ultimate plan (request.footprint()).
Any other plan Runs, but delta is ESTIMATED from lower-timeframe bars, labelled APPROXIMATE in the panel. POC migration is unavailable.
Chart type Standard candles / bars. Heikin Ashi, Renko and other synthetic types are not supported.
Symbol Needs volume. Symbols without volume produce no complete bars and therefore no signals.

Install

  1. Open the Pine Editor at the bottom of a TradingView chart.
  2. Paste the full contents of CivalPatternLab.pine (or Open > New blank indicator and replace the text).
  3. Click Save, then Add to chart.
  4. Set the pattern and simulation inputs, then set the Holdout dates (Validation begins / Untouched test begins). Leave a date at 1970-01-01 for (not set).
  5. Optional alerts: Create alert > Condition: Cival Pattern Lab > Any alert() function call. Alerts are off by default (input Alerts on closed signal / level touch), as in the original; they fire only when a bar closes.

The status line (second row of the panel) always says which data mode is active: FOOTPRINT (real buy/sell rows), ESTIMATED ... APPROXIMATE or MIXED (both modes occurred in the loaded history).

Verification note: the script was compiled on TradingView's servers (0 errors, 0 warnings). It has not been observed running on a live chart or against a Premium footprint feed in the build environment. Inspect results on your own data before relying on them.

Feature matrix

Values: Full / Approximate / Not available / Not ported.

Feature ATAS original This port Notes
Pattern: Engulfing Yes Full Same formula. Volume/delta filters use footprint, or estimate (Approximate).
Pattern: DeltaReversal Yes Full / Approximate Uses delta of this and previous bar. Approximate when either bar uses estimated delta (label shows est. delta).
Pattern: Absorption Yes Full / Approximate Close-location 0.65 fixed, as in the original.
Pattern: BreakoutRetest Yes Full / Approximate Range = highest high / lowest low of the prior lookback bars excluding the previous bar.
Pattern: ReversalFiveBar Yes Full / Approximate Close sequence a0>a1>a2<a3<a4 (and mirror) + delta sign of the signal bar.
Pattern: CandleSequence (U/D/N, 2-20 chars, side +1/-1) Yes Full Invalid sequence text = no signals. Still subject to the volume and delta filters, as in the original.
Volume / prior-mean filter Yes Full / Approximate Volume = classified buy+sell volume of the bar.
Minimum absolute delta % filter Yes Full / Approximate
Require directional POC migration Yes Full with footprint; Not available with estimated delta With estimated delta the rule cannot be evaluated, so signals are suppressed while it is on (fail closed) and the panel says so.
Footprint-complete gating (classified volume within 1 % of candle volume; prior lookback bars too) Yes Full Tolerance exposed as a port-only input (default 1 %). Applies to the estimate as well.
Closed-bar signals, no repaint Yes Full All state changes happen on barstate.isconfirmed; no lookahead_on; no future data.
Signal marker + LAB <pattern> label Yes Full Up/down label at bar low/high, bull/bear colours. Label overlap avoidance is Not ported.
Next-bar-open entry simulation Yes Full Entry at the open of the bar after the signal.
Stop (ticks), target = stop x multiple, max hold bars Yes Full Tick = syminfo.mintick.
Round-trip costs in price units Yes Full Subtracted from every trade.
Stop-first on ambiguous bars, stop/target gap fills, ambiguity count Yes Full Gap against the stop fills at the open; favourable gap is capped at the target.
One position at a time; open trade at end of history not counted Yes Full Panel shows pending.
MAE / MFE bounds Yes Full Full-bar extrema, therefore bounds, not executable excursions.
Chronological partitions: Train / Validation / Test, boundary-crossing trades excluded Yes Full Same predicates as the original panel.
Partition guard (test must follow validation) Yes Full Invalid order suppresses new signals and says INVALID.
Statistics: n, win %, expectancy, profit factor, max drawdown, ambiguous, avg MAE/MFE Yes (n, win %, expectancy; PF / DD for All) Full Port adds a results table with all columns for All / Train / Validation / Test.
Trade outcome availability time Next candle time Full exitTime is set to the open time of the bar after the exit bar.
Information panel (9 lines) Yes Full content Rendered as a Pine table. Default Compact panel shows title + two lines, as in the original; the results table carries the numbers.
Panel top offset / width in pixels, automatic panel placement Yes Not ported Tables are placed by corner: use Panel position / Results table position.
Panel font size Yes Approximate Mapped to TradingView's text size steps.
Chart-clarity compact mode (Compact display / Full analysis detail) Yes Approximate Compact mode hides the signal markers; the cross-indicator "current chart read" board is Not available (scripts cannot see each other).
Alerts on closed signal Yes (off) Full alert() once per bar close; off by default. Alert sound setting is Not ported (set in the TradingView alert dialog).
CSV export (PatternLab-trades.csv, PatternLab-bars.csv, signals/zones) Yes Not available Pine cannot write files.
pattern_research.py walk-forward grid Companion script Not available It reads the CSV export, which Pine cannot produce.
Share with Cival Decision Panel Yes Not ported No cross-indicator bridge on TradingView.
Censored-trade counter Yes Not ported Pine bar series has no index gaps; the original's counter would always be 0.
Presets / review mode None in this indicator n/a

Settings mapping

Names and groups mirror the ATAS display names. Defaults come from Cival.PatternLab.settings.json.

Group Input Default Notes
Rules Custom sequence (U up / D down / N doji) DDDUU
Rules Custom sequence side (+1 / -1) 1 Any non-negative value = +1.
Rules Pattern DeltaReversal Engulfing, DeltaReversal, Absorption, BreakoutRetest, ReversalFiveBar, CandleSequence
Rules Prior lookback bars 20 (3-500)
Rules Volume / prior mean 1 (0-20)
Rules Minimum absolute delta % 20 (0-100)
Rules Require directional POC migration off Footprint only.
Simulation Stop distance (ticks) 20
Simulation Target / stop multiple 2
Simulation Maximum holding bars 20
Simulation Round-trip costs in price units 0
Holdout Validation begins (chart time) not set 1970-01-01 = not set. The date picker produces a UNIX time which is compared with bar open times.
Holdout Untouched test begins (chart time) not set
Appearance Show information panel on Also controls the results table.
Appearance Show labels on Off = arrow only.
Appearance Bull color / Bear color #3CB371 / #FF6347
Information panel Panel font size 13 (10-22) Approximate mapping.
Information panel Compact panel (title + two lines) on
Performance Maximum bars back 10000 Bars older than this from the last bar are not processed.
Alerts Alerts on closed signal / level touch off Pattern Lab has no levels; applies to signals.
00 Chart clarity Compact display (full detail must be off) / Full analysis detail on / on

Port-only inputs (group Port (TradingView only)): Footprint ticks per row (POC resolution, default 1), Estimation timeframe (blank = automatic), Footprint completeness tolerance % (default 1), Panel position, Show results table, Results table position.

Not ported (no equivalent or no effect in the original):

ATAS setting Reason
Session start / Session timezone / Initial balance minutes Inherited from the base class; Pattern Lab does not use them.
Panel top offset, Panel width, Automatic panel placement Pixel layout; replaced by corner positions.
Show readiness/status panel No effect for this indicator class in the original.
Compact volume numbers, Show bubble volume numbers, Bubble number color Pattern Lab draws no volume bubbles.
Avoid overlapping labels, Minimum bar spacing for signal labels Need pixel geometry that Pine cannot read.
Maximum visible zones, Show touched levels Pattern Lab creates no zones.
CSV export folder Pine cannot write files.
Alert sound Chosen in the TradingView alert dialog.
Share with Cival Decision Panel No cross-indicator bridge.

Known differences from ATAS

  1. Data source. ATAS reads bid/ask per price from your data provider. TradingView footprint rows come from TradingView's own intrabar data and buy/sell classification, so volumes, delta and POC can differ from ATAS on the same instrument. Expect different signals bar by bar; the rules themselves are identical.
  2. Estimated delta (no footprint). Each lower-timeframe bar inside the chart bar is classed as up or down by close vs open (ties keep the previous direction) and its volume is added to buy or sell. This is a proxy for aggression, not measured aggression. It is flagged APPROXIMATE everywhere it is used; bars whose classified volume does not match candle volume within the tolerance are treated as incomplete and produce no signal. Default lower timeframe by chart timeframe: 1D or higher uses 15m, 4h to under 1D uses 5m, 5m to under 4h uses 1m. Charts under 5 minutes fall back to chart-bar direction (no intrabar detail) unless you enter a lower timeframe such as 1S, which needs a plan with seconds data.
  3. POC. Taken as the midpoint of TradingView's POC row (rows are ticks per row wide, default 1). ATAS takes the lowest price among equal-volume rows; TradingView's tie rule is not documented. Only the direction of POC change is used.
  4. Estimated-bar POC. Estimated bars have no POC, so Require directional POC migration blocks signals that depend on them.
  5. Exit time. Set to the open time of the next bar (ATAS: next candle time). For the newest trade it is provisional (bar close) until the next bar exists.
  6. Holdout dates. Compared as UNIX timestamps with bar open/exit times. How the date picker maps a calendar time to UNIX time follows TradingView's input widget, not an ATAS "chart time" setting.
  7. Arithmetic. ATAS uses decimal; Pine uses floating point. Equality at exact tick boundaries (touching a stop or target exactly) can differ by rounding.
  8. Markers. TradingView keeps at most 500 labels; on very long histories only the most recent markers remain visible (statistics still use every processed signal).
  9. History depth. TradingView limits how many bars and how much footprint/intrabar history your plan loads. Statistics cover only the loaded, processed bars; the trade list is capped at 10,000 like the original.
  10. Historical vs realtime estimates. Lower-timeframe data can be revised between historical load and realtime; estimated bars may therefore differ slightly after a reload (TradingView documents this repainting risk for request.security_lower_tf).
  11. Live bar. The original's live-bar handling does not apply: nothing is evaluated until the bar closes.

NinjaTrader 8 (NinjaScript)

Cival Pattern Lab — NinjaTrader 8

Compile on import: NinjaScript Editor → F5. This file has not been compiled against NinjaTrader 8 (NT8 was not available where the port was written). It was type-checked at C# 7.3 against hand-written stand-ins for the NinjaScript / SharpDX types, and every NT8 API name was checked against the NinjaTrader 8 help guide, but only your F5 compile proves it against the real platform.

Summary and requirements

Cival Pattern Lab is a research indicator. It applies one of six transparent rules (Engulfing, DeltaReversal, Absorption, BreakoutRetest, ReversalFiveBar, CandleSequence) to closed bars, gated on volume versus the prior mean and absolute delta %, with an optional directional POC-migration filter. Every match is then run through a conservative simulation: entry at the next bar's open, a stop in ticks, a target equal to the stop times a multiple, a maximum holding time, a round-trip cost, stop-first on ambiguous bars. Results are split into train / validation / untouched test partitions by date and summarised in a panel (n, win %, expectancy, profit factor, drawdown). Trades and bar features can be exported to CSV. It is an Indicator (not a Strategy), places no orders and makes no network calls. It reports observed simulation results on your own data; it makes no profit, win-rate or accuracy claim, and changing parameters is another research trial, not independent evidence.

Requirements:

Install

  1. Copy CivalPatternLab.cs to Documents\NinjaTrader 8\bin\Custom\Indicators\.
  2. In NinjaTrader open New → NinjaScript Editor and press F5 (Compile). The editor adds its own generated-code section at the bottom of the file on a successful compile.
  3. Open a Volumetric chart, right-click → Indicators → Cival Pattern Lab.
  4. The panel starts in Compact mode (title + two lines, as in the ATAS original). Untick "Compact panel" to see the train / validation / test statistics.
  5. Set Validation begins and Untouched test begins (chart time, in order) before judging results. "(not set)" is DateTime.MinValue and shows as 1/1/0001 in the grid.

Feature matrix

Feature ATAS original This port Notes
Six pattern families + custom U/D/N sequence Yes Full Same rules, same 0.65 close-location constant. Needs Volumetric data (see below).
Volume / prior mean and |delta| % gates Yes Full Prior mean over the previous Lookback bars.
Directional POC migration filter Yes Approximate POC from GetMaximumVolume; tie-break and Ticks-per-level behaviour can differ from ATAS (see differences).
Bar delta / classified volume source Bid/ask footprint rows Approximate Volumetric TotalBuyingVolume − TotalSellingVolume; follows the series' delta type.
Footprint completeness (1 % reconciliation) Yes Full Classified volume must match bar volume within 1 %; otherwise the bar cannot trigger or serve as a prior bar.
Disabled-with-status on missing footprint Yes Full Visible panel status on non-Volumetric charts.
Closed-bar processing, no repaint Yes Full Calculate.OnBarClose.
Next-bar-open simulation, one position at a time Yes Full
Stop ticks, target = stop × multiple, max hold, round-trip cost Yes Full Prices compared with a 1e-6-tick tolerance (doubles instead of decimals).
Stop-first on ambiguous bars, gap fills, ambiguity count Yes Full
MAE / MFE full-bar bounds Yes Full Bounds, not executable excursions.
Censored / pending positions Yes Full Missing bar index censors the position.
Train / validation / test partitions, boundary exclusion Yes Full Chart time, see differences for the time basis.
Panel with n, win %, expectancy, PF, drawdown, ambiguous, censored, pending Yes Approximate Drawn by the indicator (SharpDX); no cross-indicator auto-arrange.
Signal markers + "LAB " labels Yes Full Triangle glyph + label with overlap avoidance and bar-spacing rule.
Compact display / Full analysis detail Yes Approximate Full detail expands abbreviations as the original does; compact draws nothing for Pattern Lab (same as ATAS); the shared "current chart read" board is not ported.
CSV export: PatternLab-trades.csv, PatternLab-bars.csv, PatternLab-signals.csv Yes Full Same columns. PatternLab-zones.csv is header-only (Pattern Lab has no zones). Blank folder = disabled.
pattern_research.py walk-forward companion Yes Full Reads the same PatternLab-bars.csv columns. Time column is NT chart time.
Alerts (off by default) Yes Approximate NT Alert() in real-time only; sound name maps to <NT install>\sounds\<name>.wav.
Rebuild when provider revises already-processed history Yes Not available NT has no equivalent callback; reload the data / press F5 on the chart.
Share with Cival Decision Panel Yes (ATAS-only bridge) Not ported Not part of the shipped settings reference.
Review mode / presets None in the original — —

Settings mapping

ATAS group / name NT8 property Default Notes
Rules / Custom sequence (U up / D down / N doji) CandleSequence DDDUU
Rules / Custom sequence side (+1 / -1) SequenceSide 1
Rules / Pattern Pattern DeltaReversal Enum; no [NinjaScriptProperty] on purpose (keeps NT's generated code free of the nested enum type).
Rules / Prior lookback bars Lookback 20 (3–500)
Rules / Volume / prior mean VolumeMultiplier 1 (0–20) double
Rules / Minimum absolute delta % DeltaPercent 20 (0–100) double
Rules / Require directional POC migration PocConfirmation false
Simulation / Stop distance (ticks) StopTicks 20
Simulation / Target / stop multiple RewardMultiple 2 double
Simulation / Maximum holding bars HoldBars 20
Simulation / Round-trip costs in price units Costs 0 double
Holdout / Validation begins, Untouched test begins ValidationStart, TestStart not set DateTime
Appearance / Show information panel, Panel top offset, Panel width ShowPanel, PanelTop, PanelWidth true, 50, 380
Appearance / Avoid overlapping labels, Minimum bar spacing, Show labels AvoidLabelOverlap, MinimumLabelBarSpacing, ShowLabels true, 6, true
Appearance / Bull color, Bear color BullColor, BearColor MediumSeaGreen, Tomato WPF Brush (NT convention)
Information panel / Panel font size, Compact panel PanelFontSize, CompactPanel 13, true
Export / CSV export folder (blank disables) ExportFolder blank
Performance / Maximum bars back MaxBarsBack 10000 Only the latest N bars are processed.
Alerts / Alerts on closed signal / level touch, Alert sound EnableAlerts, AlertSound false, alert1
00 Chart clarity / Compact display, Full analysis detail CleanChart, FullAnalysisDetail true, true

Not ported (and why)

ATAS setting Reason
Session start / Session timezone / Initial balance minutes Have no effect in the ATAS Pattern Lab; omitted rather than shown as dead controls.
Automatic panel placement Needs ATAS's shared panel registry. In NT8 give each Cival panel a different Panel top offset.
Show readiness/status panel Has no effect in the ATAS analytics indicators.
Compact volume numbers, Show bubble volume numbers, Bubble number color Pattern Lab draws no volume bubbles.
Maximum visible zones, Show touched levels Pattern Lab has no zones.

Known differences from the ATAS original

  1. Order-flow source. ATAS builds delta and POC from bid/ask footprint rows; this port reads the Volumetric series (BarDelta, TotalBuyingVolume, TotalSellingVolume, GetMaximumVolume). With the default BidAsk delta type the numbers represent the same quantity; with UpDownTick they do not.
  2. POC tie-break. ATAS picks the lowest price among equal-volume rows. NinjaTrader returns the highest-volume level's price and, when Ticks per level is above 1, the lowest price of that level; ties are not specified. This only matters when Require directional POC migration is on.
  3. Time basis. NinjaTrader stamps time-based bars with their close time. Bar open time (used for the entry time and the Validation / Test comparisons) is derived exactly for Minute and Second bars (including the base period of Volumetric bars) and otherwise taken as the previous bar's stamp. The exit time is the exit bar's close stamp, the same "outcome known at the candle boundary" meaning as the original. Dates are compared in the chart's time (NinjaTrader's own clock); no time-zone conversion is applied.
  4. Numeric type. Prices are doubles with a 1e-6 tick tolerance on equality-sensitive comparisons; ATAS uses decimals. A signal sitting exactly on a threshold can differ in rare cases.
  5. Compact panel default. As in the original, the default panel shows only three lines. Untick Compact panel for statistics.
  6. Panels. Panels are drawn with SharpDX at the Panel top offset; there is no cross-indicator auto-arrangement.
  7. Export cadence. Files are rewritten on the last historical bars and then on each real-time bar close. Archive them before loading another chart; use a separate folder per symbol/timeframe.

No profitability or vendor-output parity is claimed. Synthetic and historical simulations validate software behaviour, not market edge.