Skip to main content
ATK Pine Script®

PyneScript to Nautilus Flow

Canonical order flow from build_signal_frame through backtest, replay, and live execution in ATK.

PyneScript Strategy to Backtest to Live: One Canonical Flow#

build_signal_frame(...)
  -> emit entry_* / sl / tp / trail_offset
  -> build_trade_frame(...) returns build_mapped_trade_frame(signal_df)
  -> normalize_strategy_trade_frame(...)
  -> execution core builds OrderIntent
  -> ExecutionPolicyEngine pre_trade_check(...)
  -> batch backtest / replay / live session submit path
  -> unified order primitives and reports

What is unified already#

The strategy layer uses one canonical trade-frame schema, one normalizer, and one execution-domain intent model before dispatch. That is the core contract shared by batch simulation, replay, and live signal execution.

What to keep explicit#

PyneScript strategy authors should target the canonical trade-frame schema first, not adapter-specific order factories. That keeps strategy code portable across backtest, replay, and live execution paths.

Intent Helpers Are Supported, But Trade-Frame Fields Stay Canonical#

What the helpers are for#

strategy.entry/order/exit/close/cancel* build explicit payload dictionaries and are part of the supported runtime surface. They are useful for templates, diagnostics, metadata-rich examples, and future-facing authoring consistency.

What still drives execution#

The current ATK execution pipeline still expects real strategy intent to be emitted through canonical trade-frame fields in build_signal_frame(...), then normalized by build_trade_frame(...). Do not replace that flow with helper payloads in production examples.

# Supported helper payload.
entry_template = strategy.entry("L", "BUY", when=True, limit=100.0)


# Canonical ATK execution path.
frame["entry_side"] = "BUY"
frame["entry_price"] = frame["open"]
frame["quantity"] = 1.0
frame["size_pct"] = 0.0