Chuyển đến nội dung chính
ATK Pine Script®

Luồng Xử Lý

Các pipeline runtime cho indicator, strategy và library script — cách mỗi loại khai báo chảy từ input qua thực thi hoặc render.

Luồng Xử Lý Indicator, Strategy và Library#

Luồng indicator#

Sử dụng khi script tính toán các analysis series rồi render chúng thông qua khai báo tĩnh hoặc build_visuals(...) chỉ dùng để render.

indicator(...)
  -> input.* defaults register into module context
  -> build_indicator_frame(df, params)
  -> frame columns + optional static attrs config
  -> static plot declarations and/or build_visuals(frame, params, ctx)
  -> managed visual snapshot
  -> ATK visual router and adapters

Luồng strategy#

Sử dụng khi script xuất các trường trade-frame chuẩn mà ATK sẽ chuẩn hóa thành execution intent cho backtesting, replay và live runtime.

strategy(...)
  -> input.* defaults register into module context
  -> build_signal_frame(df, params)
  -> entry_* / sl / tp / trail_* prepared
  -> build_trade_frame(signal_df, params, styles)
  -> build_mapped_trade_frame(signal_df) or equivalent mapping-only normalization
  -> normalized trade frame
  -> execution intent model
  -> backtest / replay / live execution path

Luồng library#

Sử dụng khi script chỉ tồn tại để export các function, hằng số hoặc enum type tái sử dụng cho các module PyneScript khác.

library(...)
  -> exported callables and enum types discovered from the module
  -> publish metadata and dependency reports generated
  -> importing script calls import_library(...) or library_import(...)
  -> selected exports resolve into a namespace object
  -> indicator or strategy script reuses the helpers in its own builders