PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge Namespace Reference

Namespaces

namespace  admission
 
namespace  broker
 
namespace  checked_settings
 
namespace  compat
 
namespace  detail
 
namespace  engine_script_run_v20
 
namespace  execution
 
namespace  exit_legs
 
namespace  internal
 
namespace  math
 
namespace  metrics
 
namespace  na_detail
 
namespace  native_bar_views_v1
 
namespace  native_calc
 
namespace  native_calendar
 
namespace  native_driver_v5
 
namespace  native_fx_curve_v1
 
namespace  native_module
 
namespace  native_order
 
namespace  native_run_spec_v3
 
namespace  native_toolkit
 
namespace  order_action
 
namespace  order_cancellation_v1
 
namespace  pine_color
 
namespace  report
 
namespace  report_sequence
 
namespace  report_sink
 
namespace  reservation_expansion_v1
 
namespace  selected_window_plan_v1
 
namespace  source
 
namespace  ta
 

Data Structures

struct  AggregatedBar
 
class  BacktestEngine
 
struct  Bar
 
class  BirthCursor
 
class  BorrowedBarFeedReader
 
struct  Box
 
struct  BoxRec
 
class  BrokerStateHashProvider
 
class  BrokerStateHashSink
 
struct  CacheCapacity
 
struct  CacheDefaults
 
struct  CancellationTarget
 
struct  ChartPoint
 
struct  ClosedLotExcursion
 
struct  ClosedLotExcursionFacts
 
class  coded
 Base with a code: throw coded<std::invalid_argument>(code, {args}, text). More...
 
struct  DrawingAllocationDiagnostic
 
struct  DrawingAllocationResult
 
class  DrawingArena
 
struct  DrawingBoundConfig
 
class  DynamicRingBuffer
 
class  ExitLegActivation
 
struct  ExitLegActivationBounds
 
struct  FeedBarRow
 
class  FeedReader
 
class  GenericMatrix
 
class  GenericMatrix< bool >
 
class  IExecutionConsumer
 
class  INativeDriverSink
 
struct  IntrabarPath
 An owned lower-timeframe execution path. More...
 
struct  IsOwnedAllocator
 
struct  IsOwnedAllocator< OwnedAllocator< T, E > >
 
class  KahanWindowSum
 
struct  Label
 
struct  LabelRec
 
class  LedgerCachePolicy
 
struct  Line
 
struct  Linefill
 
struct  LinefillRec
 
struct  LineRec
 
class  MapCapacityError
 
struct  MetricsPlainDeclarationV1
 
struct  MetricsPlainInputsV1
 
struct  NativeAccountObservation
 The account row that follows an applied execution in the event history: the shared ordinal, the effective time, the marked equity, the realized balance and the signed book after it. More...
 
struct  NativeAnchoredLevelView
 Ephemeral read-only facts of one anchored-leg materialization (L7b), offered to the host exactly once, before the ArmedEvent is built. More...
 
struct  NativeAuxiliaryAppendResult
 What append_auxiliary_bars_result answers: the status, the refusal by name, and which bar OF THIS CALL it stopped on. More...
 
struct  NativeAuxiliaryFeed
 An auxiliary feed of the run's OWN symbol at a timeframe strictly finer than the input: the bars the input feed does not have. More...
 
struct  NativeBarView
 Borrowed OHLCV span: a bar pointer and a row count. More...
 
struct  NativeBarViews
 Explicit read context for feeds and lower paths. More...
 
struct  NativeBeginArgs
 Borrowed begin-call facts. More...
 
struct  NativeCompleted
 
struct  NativeCoordinate
 Everything the kernel knows about WHERE a point is, as one owning value: its event ordinal, the script interval index, the named input interval index, the nominal and scheduled-eligible opens, the last traded close, the next period and next input opens, the effective time the account converts and hashes at, the source price time, and the three classifications above. More...
 
struct  NativeCurrentExecution
 A synchronous execution of one request accepted or replaced in this very callback: a target handle and a price rule, and nothing else. More...
 
struct  NativeCurrentExecutionPreview
 Recomputed observations, never an apply token. More...
 
struct  NativeCurrentPointView
 What current_execution_point() answers inside a callback: the point's decision context, its price, which quote that price is, and the ordinal the quote came from. More...
 
struct  NativeDayPartition
 
class  NativeDayPartitionScope
 
struct  NativeDecisionContext
 
struct  NativeDriverPoint
 One point the driver produced: its coordinate, the raw price before slippage or any grid, the provider's sequence for an observed print (nullopt otherwise), and whether the point is a matching point, an excursion sample, or both. More...
 
struct  NativeDriverStatistics
 
struct  NativeExecutionTermsFacts
 Read-only owning-value facts for one candidate. More...
 
struct  NativeFailed
 
struct  NativeFailure
 The durable record native_state().failure answers: the code, the operation it happened in, an optional event ordinal and discriminator, and the allocation-free context. More...
 
struct  NativeFailureContext
 The three in-run facts a failure may carry, tagged by kind. More...
 
struct  NativeFxCurve
 An immutable account-currency FX curve: parallel arrays of effective-from timestamps in epoch milliseconds and the account-currency units per one unit of the symbol's quote currency. More...
 
struct  NativeFxCurveSetupResult
 What configure_native_fx_curve answers: the status and, on refusal, the curve validation with the index of the first bad point. More...
 
struct  NativeFxCurveValidation
 What validate_native_fx_curve and configure_native_fx_curve report: the error and the index of the element that failed. More...
 
struct  NativeInputContext
 Accepted input facts presented before the generic consumer aggregates the bar into its script interval or evaluates any matching point. More...
 
struct  NativeInputPreflightResult
 What preflight_native_inputs answers: the error and the first offending bar's index, or -1 when the refusal is not about one bar. More...
 
struct  NativeInRunCause
 The event ordinal a failure was caused by, 0 when absent. More...
 
struct  NativeInRunCursor
 Where on the modeled path a failure happened: the driver point's coordinate and its interpolation position t. More...
 
struct  NativeInRunRecipient
 The request incarnation a failure was addressed to, 0 when absent. More...
 
struct  NativeInstrumentColumn
 One named column an instrument feed carries beside its OHLCV: one value per bar, in bar order. More...
 
struct  NativeInstrumentFeed
 Another instrument's own bars of one timeframe, installed as data. More...
 
struct  NativeInstrumentFeedReadView
 Effective feed data from owned vectors or a borrowed view. More...
 
struct  NativeInstrumentFeedView
 Borrowed instrument feed. More...
 
struct  NativeLossLimit
 One risk threshold (L9). More...
 
class  NativeLowerPathSource
 Four-operation source for full-path and windowed access. More...
 
struct  NativeMarginCallView
 Ephemeral factual view of one kernel-issued liquidation before its units are fixed. More...
 
struct  NativeMarginCheckPoint
 Ephemeral factual view of one kernel check point, offered to the host before the check runs. More...
 
struct  NativeMarginDecision
 The host's answer to one requirement view. More...
 
struct  NativeMarginModel
 A generic per-side broker margin model (L4). More...
 
struct  NativeMarginRequirementView
 Ephemeral factual view of the numbers the kernel is about to compare, at one check point, BEFORE the breach test. More...
 
struct  NativeMarketEvent
 One owning row of native_events(after_ordinal): a command event, a driver point or an account observation, tagged by kind. More...
 
struct  NativeOpenLot
 Owning value row for one open physical lot, copied at query time by native_open_lots(mark) — the lot-by-lot view of the same book physical_position() aggregates. More...
 
struct  NativeOpenLotView
 Callback-local view of the same FIFO row. More...
 
struct  NativePhysicalPosition
 The book as one aggregate: signed units, the volume-weighted average entry price and the number of open physical lots. More...
 
struct  NativePrecommitView
 Ephemeral factual view of one prepared execution before any physical effect. More...
 
struct  NativeReady
 
struct  NativeRiskLimits
 Generic account risk limits (L9), entirely opt-in: a spec that leaves NativeRunSpec::risk unset evaluates nothing, appends no event and folds nothing into the continuation digest. More...
 
struct  NativeRiskState
 The run's generic risk ledger (L9), as the kernel holds it. More...
 
struct  NativeRunning
 
struct  NativeRunSpec
 One complete setup value, staged/copied by NativeStrategyHost before it is applied at begin. More...
 
struct  NativeRunSpecValidation
 Allocation-free facts suitable for the host's durable failure variant. More...
 
struct  NativeSetupResult
 What configure_native answers: the status and, on refusal, the first error field validate_native_run_spec found. More...
 
struct  NativeStateView
 The flattened run state native_state() answers: the lifecycle kind, a borrowed pointer to the staged spec (nullptr when Unconfigured), the phase, how a Completed run ended, the durable failure, the consumed run-number high water and the monotonic decision floor. More...
 
class  NativeStrategyHost
 The public native host: an abstract subclass of BacktestEngine with no PineScript on it. More...
 
struct  NativeTickContext
 One accepted realtime print before native matching at its current decision point. More...
 
struct  NativeTimeframeBarContext
 One completed higher-timeframe bucket of a declared subscription (NativeRunSpec::subscriptions), presented before the calculation of the input bar it is delivered on. More...
 
struct  NativeTimeframeSubscription
 
struct  NativeTrailState
 Read-only projection of a live generic Trail request. More...
 
struct  NativeUnconfigured
 The NativeLifecycle alternatives, one per NativeLifecycleKind. More...
 
struct  NativeWorkingRequest
 Owning value row for one live request, copied at query time. More...
 
class  NumericMatrix
 
class  OpenReportRowSource
 
class  OrderBirth
 
class  OrderCancellationReceipt
 
class  OwnedAllocator
 
class  OwnedDeque
 
class  OwnedStorage
 
struct  OwnedStorageTraits
 
struct  OwnedStorageTraits< std::array< T, N > >
 
struct  OwnedStorageTraits< std::deque< T, A > >
 
struct  OwnedStorageTraits< std::optional< T > >
 
struct  OwnedStorageTraits< std::pair< A, B > >
 
struct  OwnedStorageTraits< std::string >
 
struct  OwnedStorageTraits< std::tuple< T... > >
 
struct  OwnedStorageTraits< std::unordered_map< K, V, H, E, A > >
 
struct  OwnedStorageTraits< std::vector< T, A > >
 
struct  OwnedStorageTraits< T, std::void_t< decltype(std::declval< const T & >().observe_owned_storage(std::declval< OwnedStorage & >()))> >
 
struct  OwnedStorageUsage
 
class  OwnedUnorderedMap
 
struct  pine_drawing_error
 
struct  pine_drawing_id_exhausted
 
class  PineMap
 
struct  PyramidEntry
 
class  QuantityIntent
 
class  QuantityRequest
 
struct  QuantityReservation
 
struct  ReportC
 
struct  ReportEnvelopeV1
 
class  ReservationExpansion
 
struct  ReservationExpansionCapture
 
class  ReservationGrowthSource
 
struct  RunFailureArg
 One typed argument as a raise site spells it. More...
 
class  RunFailureInfo
 The code carried beside a thrown exception. More...
 
struct  RunFailureValue
 A validated code and its canonical arguments: the JSON object with its keys sorted and no whitespace, or null for a code without arguments ("{}"). More...
 
class  RuntimeBatchLease
 
class  RuntimeContextEvaluator
 
struct  RuntimeContextEvent
 
struct  RuntimeContextHandle
 
struct  RuntimeContextKey
 
class  RuntimeContextService
 
class  RuntimeHistoryBudgetExhausted
 
struct  RuntimeHistoryOptions
 
class  RuntimeHistorySource
 
struct  RuntimeHistoryUsage
 
class  RuntimeStorageObservationIncomplete
 
struct  RuntimeSubdivision
 
struct  ScratchIoPolicy
 
class  ScriptArray
 
class  ScriptArrayTransaction
 
struct  ScriptStrFormatValue
 
class  ScriptString
 
class  ScriptStringParts
 
class  ScriptStringScope
 
struct  SecurityDiagC
 
struct  SelectedPlanRequest
 
struct  SelectedPrimaryPlan
 
struct  SelectedRetainedCount
 
struct  SelectedRetainedRequest
 
class  SelectedWindowQueryAfterSeal
 The refusal of a read-only state query, or of a report-only write, that may no longer be answered. More...
 
class  Series
 
struct  StreamOrderAction
 
struct  StrFormatValue
 
struct  SymInfo
 
class  TimeframeAggregator
 
struct  TraceEntryC
 
struct  Trade
 
struct  TradeC
 
class  TradeLedger
 
struct  TradeTick
 
struct  WindowCacheCapacity
 
class  WindowCacheScope
 
struct  WindowCacheStats
 

Typedefs

using PineExitActivationPolicy = compat::pine::ExitActivationPolicy
 
using PineHistoricalBirthReach = compat::pine::HistoricalBirthReach
 
using LotExcursionHook = std::function<ClosedLotExcursion(const ClosedLotExcursionFacts&)>
 
using ExitLegLifecycle = exit_legs::Lifecycle
 
using InputsMap = std::unordered_map<std::string, std::string>
 
template<typename T>
using PineGenericMatrix = GenericMatrix<T>
 
using PineMatrix = NumericMatrix
 
using NativeLifecycle
 The lifecycle as one value. Exhaustive over the five alternatives above.
 
using NativeCurrentExecutionResult
 What execute_current answers: a refusal, or the applied outcome.
 
using NativeLegacyTolerance = NativeFeedTolerance
 Deprecated spelling of the tolerance type.
 
using RunFailureArgs = std::vector<RunFailureArg>
 
using MarketAdmissionDraft = admission::Draft
 
using MarketAdmissionJournal = admission::Journal
 

Enumerations

enum class  XLoc : int {
  bar_index = 0 ,
  bar_time = 1
}
 
enum class  YLoc : int {
  price = 0 ,
  abovebar = 1 ,
  belowbar = 2
}
 
enum class  DrawingKind : std::uint8_t {
  line ,
  box ,
  label ,
  linefill
}
 
enum class  DrawingAccessStatus : std::uint8_t {
  invalid ,
  stale ,
  present
}
 
enum class  DrawingAllocationStatus : std::uint8_t {
  ok ,
  drawing_slot_bound_exceeded ,
  pine_drawing_id_exhausted
}
 
enum class  PositionSide {
  FLAT ,
  LONG ,
  SHORT
}
 
enum class  OpenedLotFillPoint : std::uint8_t {
  OnPath = 0 ,
  AfterPath = 1
}
 
enum class  ReportMode : std::uint32_t {
  FULL = PF_REPORT_MODE_FULL ,
  SUMMARY_ONLY = PF_REPORT_MODE_SUMMARY_ONLY ,
  STREAMED = PF_REPORT_MODE_STREAMED
}
 
enum class  QtyType {
  FIXED = 0 ,
  PERCENT_OF_EQUITY = 1 ,
  CASH = 2
}
 
enum class  CommissionType {
  PERCENT = 0 ,
  CASH_PER_ORDER = 1 ,
  CASH_PER_CONTRACT = 2
}
 
enum class  MagnifierDistribution {
  UNIFORM ,
  COSINE ,
  TRIANGLE ,
  ENDPOINTS ,
  FRONT_LOADED ,
  BACK_LOADED
}
 
enum class  NativePriceProvenance : std::uint8_t {
  Confirmed = 0 ,
  ObservedPrint = 1 ,
  ModeledOHLCOpen = 2 ,
  ModeledOHLCClose = 3 ,
  CarriedOpen = 4 ,
  AfterCalculationClose = 5 ,
  PartialFinalized = 6 ,
  Calculation = 7 ,
  CurrentExecution = 8
}
 Where a driver point's price came from. More...
 
enum class  NativePathPhase : std::uint8_t {
  None = 0 ,
  Open = 1 ,
  High = 2 ,
  Low = 3 ,
  Close = 4
}
 Which leg of a modeled OHLC walk a point sits on. More...
 
enum class  NativeCompletionKind : std::uint8_t {
  Confirmed = 0 ,
  LazyComplete = 1 ,
  SessionShortened = 2 ,
  PartialFinalized = 3
}
 How a script interval or a higher-timeframe bucket was closed. More...
 
enum class  NativeInputPolicy : std::uint8_t {
  Batch = 0 ,
  StreamWarmup = 1
}
 
enum class  NativeInputPreflightError : std::uint16_t {
  None = 0 ,
  NullArray = 1 ,
  InvalidCount = 2 ,
  StructuralInvalid = 3 ,
  Unaligned = 4 ,
  OffGridLabel = 5 ,
  NotStrictlyIncreasing = 6 ,
  OverlappingSlot = 7 ,
  InSessionGap = 8 ,
  CalendarFailure = 9 ,
  TimestampDeltaOverflow = 10
}
 Why a bar array was refused before the run touched anything. More...
 
enum class  NativeFxCurveError : std::uint8_t {
  None = 0 ,
  LengthMismatch = 1 ,
  NotStrictlyIncreasing = 2 ,
  NotFinitePositive = 3 ,
  AllocationFailure = 4 ,
  WrongPhase = 5
}
 Why a curve was refused. More...
 
enum class  NativeLifecycleKind : std::uint8_t {
  Unconfigured = 0 ,
  Ready = 1 ,
  Running = 2 ,
  Completed = 3 ,
  Failed = 4
}
 Where a host stands. More...
 
enum class  NativeRunPhase : std::uint8_t {
  Batch = 0 ,
  Warmup = 1 ,
  Realtime = 2
}
 Which driving is Running: a batch run(), a stream's internal warmup, or its realtime leg. More...
 
enum class  NativeCompletion : std::uint8_t {
  BatchComplete = 0 ,
  StreamEnded = 1
}
 How a Completed run ended: a batch reached the last bar, or a stream was ended. More...
 
enum class  NativeFailureCode : std::uint16_t {
  None = 0 ,
  InvalidSpecification = 1 ,
  Contract = 2 ,
  Preflight = 3 ,
  UnsupportedSource = 4 ,
  CallbackException = 5 ,
  SettlementFailure = 6 ,
  Allocation = 7 ,
  CounterExhausted = 8 ,
  Aborted = 9 ,
  ProjectionMismatch = 10 ,
  Calendar = 11 ,
  Unexpected = 12
}
 The durable first failure of a run, in NativeFailure::code. More...
 
enum class  NativeFailureOperation : std::uint16_t {
  None = 0 ,
  Configure = 1 ,
  Begin = 2 ,
  Command = 3 ,
  Input = 4 ,
  Callback = 5 ,
  Settlement = 6 ,
  Mutation = 7 ,
  Stream = 8
}
 Which operation was in flight when the failure latched — the second half of "what went wrong", beside NativeFailureCode. More...
 
enum class  NativeFailureContextKind : std::uint8_t {
  None = 0 ,
  Cause = 1 ,
  Recipient = 2 ,
  CauseRecipient = 3 ,
  Cursor = 4 ,
  CauseCursor = 5 ,
  RecipientCursor = 6 ,
  CauseRecipientCursor = 7
}
 In-run failure references. More...
 
enum class  NativeEventKind : std::uint8_t {
  Command = 0 ,
  Driver = 1 ,
  Account = 2
}
 Which of NativeMarketEvent's three alternatives is populated. More...
 
enum class  NativeSetupStatus : std::uint8_t {
  Applied = 0 ,
  Failed = 1
}
 Whether a setup call applied its value or refused it. More...
 
enum class  NativeAuxiliaryAppendError : std::uint8_t {
  None = 0 ,
  HostFailed = 1 ,
  Reentrant = 2 ,
  NotRealtime = 3 ,
  NoAuxiliaryFeed = 4 ,
  InvalidBarArray = 5 ,
  InvalidBar = 6 ,
  UnorderedBars = 7 ,
  InputPeriodAlreadyAccepted = 8 ,
  AllocationFailure = 9
}
 Why append_auxiliary_bars refused. More...
 
enum class  NativeCurrentPriceRule : std::uint8_t {
  AsPresented = 0 ,
  NearestTick = 1
}
 Which price a current execution settles at: the active callback's quote as presented, or that quote on the instrument's nearest tick. More...
 
enum class  NativeCurrentQuoteKind : std::uint8_t {
  MarketDecision = 0 ,
  ExecutionAnchor = 1
}
 Where a price came from: the callback's own market decision point, or the execution it is anchored to. More...
 
enum class  NativePrecommitVerdict : std::uint8_t {
  Admit = 0 ,
  Proceed = Admit ,
  Refuse = 1 ,
  AdmitWithHostMargin = 2
}
 The host is consulted before generic opening-margin admission. More...
 
enum class  NativeMarginCheckKind : std::uint32_t {
  BarOpen = 0 ,
  AfterApplied = 1 ,
  Calculation = 2 ,
  FxRoll = 3 ,
  IntrabarSample = 4
}
 Which kernel check point is about to test the maintenance requirement. More...
 
enum class  NativeAnchoredTrigger : std::uint8_t {
  Limit = 0 ,
  Stop = 1 ,
  TrailArm = 2
}
 Which trigger of an anchored leg the owner's fill is about to supply. More...
 
enum class  NativeRequestField : std::uint8_t {
  Comment = 0 ,
  Label = 1
}
 Which of a request's two free-text identity fields a bulk predicate reads. More...
 
enum class  NativeCurrentRefusal : std::uint8_t {
  NoExecutionContext = 0 ,
  Reentrant = 1 ,
  InvalidHandle = 2 ,
  NotWorking = 3 ,
  NotAcceptedInCallback = 4 ,
  UnsupportedRequest = 5 ,
  UnreadyOwner = 6 ,
  InvalidSelection = 7 ,
  ConfigurationMismatch = 8
}
 Why a current-execution command cannot be consumed here. More...
 
enum class  NativeCalculationReason : std::uint8_t {
  BarClose = 0 ,
  OrderFill = 1 ,
  Tick = 2 ,
  SubBar = 3
}
 Why the kernel is asking the host to calculate. More...
 
enum class  NativeFeeKind : std::uint32_t {
  Percent = 0 ,
  CashPerUnit = 1 ,
  CashPerExecution = 2
}
 Encodings coincide with the versioned native-v1 C transport. More...
 
enum class  NativeCloseExecution : std::uint32_t {
  NextEligiblePoint = 0 ,
  AfterCalculation = 1
}
 When a request born at a script calculation may first match. More...
 
enum class  NativeAbortReporting : std::uint32_t {
  Error = 0 ,
  Quiet = 1
}
 Abort presentation is a run-level policy rather than an exception-path convention. More...
 
enum class  NativeReportPolicy : std::uint32_t {
  HostRecorded = 0 ,
  KernelRecorded = 1 ,
  KernelRecordedAtHostMarks = 2
}
 Who records the per-script-bar report series. More...
 
enum class  NativeOpenDirections : std::uint32_t {
  None = 0 ,
  Long = 1 ,
  Short = 2 ,
  Both = 3
}
 Which opening directions the run admits at all. More...
 
enum class  NativeCalculationTrigger : std::uint32_t {
  BarClose = 0 ,
  BarCloseAndFills = 1 ,
  EveryModeledPoint = 2
}
 When the kernel asks the host to calculate. More...
 
enum class  NativeOpenBarView : std::uint32_t {
  Complete = 0 ,
  OpenOnly = 1
}
 What a bar-open callback is handed. More...
 
enum class  NativePriceGrid : std::uint32_t {
  None = 0 ,
  QuantizeFills = 1 ,
  QuantizeFillsAndTriggers = 2
}
 A generic instrument price grid. More...
 
enum class  NativeGridRounding : std::uint32_t {
  HalfUp = 0 ,
  Directional = 1
}
 HalfUp is the nearest tick with ties away from zero. More...
 
enum class  NativeLiquidationSizing : std::uint32_t {
  RestoreMinimum = 0 ,
  ShortfallMultiple = 1 ,
  Flatten = 2
}
 Which units a kernel-issued liquidation reduces (L4). More...
 
enum class  NativeLiquidationCheck : std::uint32_t {
  PathAdverseExtreme = 0 ,
  CalculationOnly = 1 ,
  PathAdverseExtremeMark = 2
}
 When the kernel tests the maintenance requirement. More...
 
enum class  NativeMarginEquityBasis : std::uint32_t {
  MarkedEquity = 0 ,
  MarkedEquityBeforeOpenCommission = 1
}
 Which equity the maintenance requirement is tested against. More...
 
enum class  NativeLiquidationLevelBase : std::uint32_t {
  MarkedEquity = 0 ,
  RealizedOnly = 1
}
 Which base the liquidation level is solved from. More...
 
enum class  NativeRiskDay : std::uint32_t {
  SessionDay = 0 ,
  CalendarDayInTimezone = 1
}
 Which day a risk limit's "day" is. More...
 
enum class  NativeRiskAction : std::uint32_t {
  BlockOpenings = 0 ,
  FlattenAndBlock = 1
}
 What a breach does. More...
 
enum class  NativeSlotLabelPolicy : std::uint32_t {
  Canonical = 0 ,
  FeedTolerant = 1 ,
  LegacyTolerant = FeedTolerant
}
 Native hosts normally require every confirmed bar to name a canonical input slot. More...
 
enum class  NativePathOrder : std::uint32_t {
  Auto = 0 ,
  HighFirst = 1 ,
  LowFirst = 2
}
 Generic ordering for a modeled OHLC path. More...
 
enum class  NativeFeedTolerance : std::uint32_t {
  None = 0 ,
  BatchStructuralBars = 1u << 0 ,
  WarmupNonNegativeOHLC = 1u << 1
}
 Explicit, opt-in admission exceptions for a tolerated input-feed shape. More...
 
enum class  NativeSeriesSource : std::uint8_t {
  Input = 0 ,
  AuxiliaryFeed = 1 ,
  InstrumentFeed = 2
}
 One declared higher-timeframe series of the run's own symbol, the native equivalent of request.security(syminfo.tickerid, tf, ...). More...
 
enum class  NativeEventRetention : std::uint32_t {
  Window = 0 ,
  Full = 1 ,
  Commands = 2
}
 What the kernel keeps of a run's event record, the rows native_events() returns (the bounded event journal). More...
 
enum class  NativeRunSpecField : std::uint8_t {
  None ,
  SessionKey ,
  RunNumber ,
  InputTimeframe ,
  ScriptTimeframe ,
  Ticker ,
  TickerId ,
  Type ,
  Currency ,
  BaseCurrency ,
  Description ,
  VolumeType ,
  Timezone ,
  Session ,
  ChartTimezone ,
  InitialCapital ,
  PointValue ,
  AccountFx ,
  PriceTick ,
  SlippageTicks ,
  FeeKind ,
  FeeValue ,
  QuantityGrid ,
  CloseExecution ,
  AbortReporting ,
  MaxAbsUnits ,
  MaxOpenLots ,
  AllowedOpenDirections ,
  InitialMarginFraction ,
  IntrabarTimeframe ,
  IntrabarSamples ,
  IntrabarDistribution ,
  IntrabarVolumeSamples ,
  IntrabarSampleEligibility ,
  TimeframeUndetected ,
  SlotLabelPolicy ,
  LegacyTolerance ,
  PathOrder ,
  ReportPolicy ,
  PriceGrid ,
  GridRounding ,
  SubscriptionTimeframe ,
  SubscriptionBars ,
  MarginModel ,
  MarginInitial ,
  MarginMaintenance ,
  MarginSizing ,
  MarginShortfallMultiple ,
  MarginMinUnits ,
  MarginCheck ,
  MarginEquityBasis ,
  MarginLevelBase ,
  Calculation ,
  OpenBarView ,
  RiskLimits ,
  RiskDrawdown ,
  RiskIntradayLoss ,
  RiskLossDays ,
  RiskFillsPerDay ,
  RiskDayBasis ,
  RiskAction ,
  AuxiliaryFeedTimeframe ,
  AuxiliaryFeedBars ,
  SubscriptionSource ,
  EventRetention ,
  QuantityTolerance ,
  InstrumentFeedInstrument ,
  InstrumentFeedTimeframe ,
  InstrumentFeedBars ,
  InstrumentFeedClose ,
  InstrumentFeedColumns ,
  SubscriptionInstrument
}
 Which field a validation refused, in deterministic first-error order. More...
 
enum class  NativeRunSpecError : std::uint8_t {
  None ,
  EmptyRequiredString ,
  EmbeddedNul ,
  InvalidUtf8 ,
  ZeroRunNumber ,
  InvalidTimeframe ,
  IncompatibleTimeframes ,
  UnresolvedTimezone ,
  InvalidSession ,
  NotFinitePositive ,
  SlippageOutOfRange ,
  UnknownFeeKind ,
  NotFiniteNonnegative ,
  UnknownCloseExecution ,
  UnknownAbortReporting ,
  UnknownOpenDirections ,
  ZeroLotLimit ,
  AllocationFailure ,
  CalendarFailure ,
  InvalidIntrabarPath ,
  UnknownIntrabarSampleEligibility ,
  InvalidUndetectedTimeframe ,
  UnknownSlotLabelPolicy ,
  UnknownLegacyTolerance ,
  UnknownPathOrder ,
  UnknownReportPolicy ,
  UnknownPriceGrid ,
  UnknownGridRounding ,
  GridRequiresPriceTick ,
  InvalidSubscriptionTimeframe ,
  SubscriptionFinerThanInput ,
  DuplicateSubscriptionTimeframe ,
  UnorderedSubscriptionBars ,
  SubscriptionWithoutTimeframe ,
  MarginModelConflict ,
  UnknownLiquidationSizing ,
  UnknownLiquidationCheck ,
  UnknownMarginEquityBasis ,
  UnknownLiquidationLevelBase ,
  UnknownCalculationTrigger ,
  UnknownOpenBarView ,
  UnknownRiskDay ,
  UnknownRiskAction ,
  ZeroRiskLimit ,
  MarginSideUndeclared ,
  InvalidAuxiliaryFeedTimeframe ,
  AuxiliaryFeedNotFinerThanInput ,
  UnorderedAuxiliaryFeedBars ,
  InvalidAuxiliaryFeedBar ,
  AuxiliaryFeedWithoutTimeframe ,
  UnknownSeriesSource ,
  SubscriptionWithoutAuxiliaryFeed ,
  SubscriptionFinerThanAuxiliaryFeed ,
  WrongPhase ,
  UnknownEventRetention ,
  AbortedHostNoReusableRunSpec ,
  SessionKeyChangedOnReuse ,
  RunNumberNotAboveConsumedHighWater ,
  InvalidInstrumentFeedTimeframe ,
  DuplicateInstrumentFeed ,
  UnorderedInstrumentFeedBars ,
  InvalidInstrumentFeedBar ,
  InvalidInstrumentFeedClose ,
  InvalidInstrumentFeedColumn ,
  SubscriptionWithoutInstrumentFeed ,
  InstrumentSubscriptionBars ,
  InstrumentOnNonInstrumentSeries
}
 Why a field was refused. More...
 
enum class  BirthCursorDomain : int32_t {
  None ,
  HistoricalPath ,
  MagnifierTicks
}
 
enum class  BirthCursorPosition : int32_t {
  None ,
  Point ,
  Segment
}
 
enum class  OrderBirthCause : int32_t {
  Unattributed ,
  DirectCommand ,
  ChartEvaluation ,
  FillEvaluation
}
 
enum class  CancellationCause : int32_t {
  None = 0 ,
  Replacement = 1 ,
  Dependency = 2
}
 
enum class  CancellationState : int32_t {
  Live = 0 ,
  Cancelled = 1
}
 
enum class  CloseClaimRelease : int32_t {
  Unbound = 0 ,
  NotApplicable = 1 ,
  Pending = 2 ,
  Released = 3
}
 
enum class  CancellationResult : int32_t {
  Applied = 0 ,
  Replay = 1 ,
  AlreadyTerminal = 2 ,
  Invalid = 3
}
 
enum class  OwnedStorageUnsupported : std::uint64_t {
  opaque_type = 1 ,
  allocator = 2 ,
  scratch_file = 4 ,
  exception_state = 8 ,
  legacy_evaluator = 16 ,
  observation_allocation = 32 ,
  scratch_extent = 64 ,
  scratch_quota_endpoint = 128 ,
  scratch_arena = 256 ,
  scratch_slab = 512
}
 
enum class  QuantityIntentKind {
  Units ,
  Fraction ,
  All
}
 
enum class  RunFailureClass : std::uint8_t {
  strategy ,
  strategy_limit ,
  no_data ,
  symbol_metadata ,
  symbol_feeds ,
  input ,
  unsupported ,
  resource ,
  engine_fault
}
 The class a code belongs to (the catalog's class). More...
 
enum class  RunFailureArgKind : std::uint8_t {
  identifier ,
  keyword ,
  vocab ,
  integer ,
  number ,
  pine_source ,
  symbol ,
  timeframe ,
  string ,
  nullable_string ,
  scalar ,
  boolean
}
 An argument's kind (the catalog's kind). More...
 
enum class  RunFailureCode : std::uint16_t {
  none = 0 ,
  chart_bars_rejected = 1 ,
  chart_bars_unreadable = 2 ,
  engine_command_value_invalid = 3 ,
  engine_invariant = 4 ,
  engine_unclassified_error = 5 ,
  harness_internal_error = 6 ,
  lot_grid_rejected = 7 ,
  no_data_request = 8 ,
  other_symbol_feed_missing = 9 ,
  other_symbol_request = 10 ,
  out_of_memory = 11 ,
  outputs_limit = 12 ,
  outputs_rejected = 13 ,
  pine_array_error = 14 ,
  pine_invalid_argument = 15 ,
  pine_matrix_error = 16 ,
  pine_na_reference = 17 ,
  pine_runtime_limit = 18 ,
  pine_string_error = 19 ,
  recalc_cap = 20 ,
  recorded_request_missing = 21 ,
  recorded_request_refused = 22 ,
  report_platform_unavailable = 23 ,
  report_post_execution_failed = 24 ,
  report_result_invalid = 25 ,
  report_shape_request_invalid = 26 ,
  report_shape_unsupported = 27 ,
  request_symbol_invalid = 28 ,
  request_timeframe_invalid = 29 ,
  request_timeframe_unsupported = 30 ,
  request_unsupported = 31 ,
  results_digest_unsupported = 32 ,
  run_aborted = 33 ,
  run_mode_unsupported = 34 ,
  run_options_rejected = 35 ,
  run_request_invalid = 36 ,
  security_feed_refused = 37 ,
  setting_rejected = 38 ,
  setting_unsupported = 39 ,
  strategy_create_failed = 40 ,
  strategy_library_incompatible = 41 ,
  strategy_runtime_error = 42 ,
  strategy_settings_rejected = 43 ,
  strategy_value_invalid = 44 ,
  stream_input_rejected = 45 ,
  symbol_feeds_refused = 46 ,
  symbol_metadata_rejected = 47 ,
  syminfo_unreadable = 48 ,
  window_boundary_unaligned = 49 ,
  window_calendar_unsupported = 50 ,
  window_feed_identity_changed = 51 ,
  window_feed_range_invalid = 52 ,
  window_input_cap_exceeded = 53 ,
  window_legacy_flag_conflict = 54 ,
  window_lineage_mismatch = 55 ,
  window_mode_unsupported = 56 ,
  window_no_observations = 57 ,
  window_preroll_out_of_range = 58 ,
  window_prestart_fill = 59 ,
  window_prestart_state_violation = 60 ,
  window_pruner_unsupported = 61 ,
  window_range_invalid = 62 ,
  window_report_mismatch = 63 ,
  window_request_invalid = 64 ,
  report_mode_unsupported = 65 ,
  report_sink_failed = 66 ,
  scratch_capacity_exceeded = 67 ,
  scratch_configuration_invalid = 68 ,
  scratch_io_failed = 69 ,
  diagnostic_budget_exceeded = 70 ,
  report_budget_exceeded = 71 ,
  report_channel_failed = 72 ,
  run_deadline_exceeded = 73 ,
  run_descriptor_limit_exceeded = 74 ,
  run_isolation_unavailable = 75 ,
  run_process_refused = 76 ,
  run_producer_failed = 77 ,
  run_quota_configuration_invalid = 78 ,
  run_resource_quota_exceeded = 79 ,
  runtime_history_budget_exhausted = 80 ,
  runtime_storage_observation_incomplete = 81 ,
  pine_map_capacity_exceeded = 82 ,
  selected_auxiliary_rows_limit_exceeded = 83 ,
  selected_bytes_limit_exceeded = 84 ,
  selected_primary_rows_limit_exceeded = 85 ,
  selected_script_bars_limit_exceeded = 86 ,
  selected_source_rows_limit_exceeded = 87
}
 
enum class  SelectedPlanStatus {
  Ok ,
  RequestInvalid ,
  CalendarUnsupported ,
  BoundaryUnaligned ,
  FeedRangeInvalid ,
  RowsUnordered ,
  InternalError
}
 
enum class  CalendarPeriod {
  NONE ,
  DAY ,
  WEEK ,
  MONTH
}
 

Functions

bool is_na (const Line &h)
 
bool is_na (const Box &h)
 
bool is_na (const Label &h)
 
bool is_na (const Linefill &h)
 
bool is_na (const ChartPoint &p)
 
DrawingBoundConfig drawing_bound (std::int32_t slot_bound, std::uint32_t pending_creation_slots=1)
 
template<class Rec>
DrawingBoundConfig drawing_bound_from_declared_count (std::int32_t declared_count=50, std::uint32_t pending_creation_slots=1)
 
DrawingBoundConfig drawing_bound_from_linefill_sample (std::int32_t sampled_bound=detail::kDrawingLinefillObservedBound, std::uint32_t pending_creation_slots=1)
 
template<class Rec, class Handle>
Rec & pf_require_live (DrawingArena< Rec > &a, Handle h)
 
template<class Rec, class Handle>
const Rec & pf_require_live (const DrawingArena< Rec > &a, Handle h)
 
int64_t pf_point_x (const ChartPoint &p, XLoc xloc)
 
Line pf_line_new (DrawingArena< LineRec > &a, int64_t x1, double y1, int64_t x2, double y2, XLoc xloc=XLoc::bar_index, bool el=false, bool er=false)
 
Line pf_line_new_pts (DrawingArena< LineRec > &a, ChartPoint p1, ChartPoint p2, XLoc xloc=XLoc::bar_index)
 
int64_t pf_line_get_x1 (DrawingArena< LineRec > &a, Line h)
 
int64_t pf_line_get_x2 (DrawingArena< LineRec > &a, Line h)
 
double pf_line_get_y1 (DrawingArena< LineRec > &a, Line h)
 
double pf_line_get_y2 (DrawingArena< LineRec > &a, Line h)
 
void pf_line_set_x1 (DrawingArena< LineRec > &a, Line h, int64_t v)
 
void pf_line_set_x2 (DrawingArena< LineRec > &a, Line h, int64_t v)
 
void pf_line_set_y1 (DrawingArena< LineRec > &a, Line h, double v)
 
void pf_line_set_y2 (DrawingArena< LineRec > &a, Line h, double v)
 
void pf_line_set_xy1 (DrawingArena< LineRec > &a, Line h, int64_t x, double y)
 
void pf_line_set_xy2 (DrawingArena< LineRec > &a, Line h, int64_t x, double y)
 
void pf_line_set_first_point (DrawingArena< LineRec > &a, Line h, ChartPoint p)
 
void pf_line_set_second_point (DrawingArena< LineRec > &a, Line h, ChartPoint p)
 
void pf_line_set_xloc (DrawingArena< LineRec > &a, Line h, int64_t x1, int64_t x2, XLoc xloc)
 
double pf_line_get_price (DrawingArena< LineRec > &a, Line h, int64_t x)
 
Line pf_line_copy (DrawingArena< LineRec > &a, Line h)
 
void pf_line_delete (DrawingArena< LineRec > &a, Line h)
 
Box pf_box_new (DrawingArena< BoxRec > &a, int64_t left, double top, int64_t right, double bottom, XLoc xloc=XLoc::bar_index)
 
Box pf_box_new_pts (DrawingArena< BoxRec > &a, ChartPoint top_left, ChartPoint bottom_right, XLoc xloc=XLoc::bar_index)
 
int64_t pf_box_get_left (DrawingArena< BoxRec > &a, Box h)
 
int64_t pf_box_get_right (DrawingArena< BoxRec > &a, Box h)
 
double pf_box_get_top (DrawingArena< BoxRec > &a, Box h)
 
double pf_box_get_bottom (DrawingArena< BoxRec > &a, Box h)
 
void pf_box_set_left (DrawingArena< BoxRec > &a, Box h, int64_t v)
 
void pf_box_set_right (DrawingArena< BoxRec > &a, Box h, int64_t v)
 
void pf_box_set_top (DrawingArena< BoxRec > &a, Box h, double v)
 
void pf_box_set_bottom (DrawingArena< BoxRec > &a, Box h, double v)
 
void pf_box_set_lefttop (DrawingArena< BoxRec > &a, Box h, int64_t left, double top)
 
void pf_box_set_rightbottom (DrawingArena< BoxRec > &a, Box h, int64_t right, double bottom)
 
void pf_box_set_top_left_point (DrawingArena< BoxRec > &a, Box h, ChartPoint p)
 
void pf_box_set_bottom_right_point (DrawingArena< BoxRec > &a, Box h, ChartPoint p)
 
void pf_box_set_xloc (DrawingArena< BoxRec > &a, Box h, int64_t left, int64_t right, XLoc xloc)
 
Box pf_box_copy (DrawingArena< BoxRec > &a, Box h)
 
void pf_box_delete (DrawingArena< BoxRec > &a, Box h)
 
Label pf_label_new (DrawingArena< LabelRec > &a, int64_t x, double y, std::string text, XLoc xloc=XLoc::bar_index, YLoc yloc=YLoc::price)
 
Label pf_label_new_pt (DrawingArena< LabelRec > &a, ChartPoint point, std::string text, YLoc yloc=YLoc::price)
 
int64_t pf_label_get_x (DrawingArena< LabelRec > &a, Label h)
 
double pf_label_get_y (DrawingArena< LabelRec > &a, Label h)
 
std::string pf_label_get_text (DrawingArena< LabelRec > &a, Label h)
 
void pf_label_set_x (DrawingArena< LabelRec > &a, Label h, int64_t v)
 
void pf_label_set_y (DrawingArena< LabelRec > &a, Label h, double v)
 
void pf_label_set_xy (DrawingArena< LabelRec > &a, Label h, int64_t x, double y)
 
void pf_label_set_point (DrawingArena< LabelRec > &a, Label h, ChartPoint p)
 
void pf_label_set_xloc (DrawingArena< LabelRec > &a, Label h, int64_t x, XLoc xloc)
 
void pf_label_set_yloc (DrawingArena< LabelRec > &a, Label h, YLoc yloc)
 
void pf_label_set_text (DrawingArena< LabelRec > &a, Label h, std::string text)
 
Label pf_label_copy (DrawingArena< LabelRec > &a, Label h)
 
void pf_label_delete (DrawingArena< LabelRec > &a, Label h)
 
Linefill pf_linefill_new (DrawingArena< LinefillRec > &a, Line l1, Line l2)
 
Line pf_linefill_get_line1 (DrawingArena< LinefillRec > &a, Linefill h)
 
Line pf_linefill_get_line2 (DrawingArena< LinefillRec > &a, Linefill h)
 
void pf_linefill_delete (DrawingArena< LinefillRec > &a, Linefill h)
 
template<class... A>
void pf_noop (A &&...)
 
std::unique_ptr< IExecutionConsumer > make_native_execution_consumer ()
 
template<typename T>
bool is_na (const GenericMatrix< T > &matrix) noexcept
 
void pine_log_info (const std::string &msg)
 
void pine_log_warning (const std::string &msg)
 
void pine_log_error (const std::string &msg)
 
void pine_runtime_error (const std::string &msg)
 
double path_at (double t, double p0, double p1, double p2, double p3, double len0, double len1, double len2, double total)
 Maps parameter t in [0,1] to a price on the 3-segment path.
 
std::vector< double > sample_price_path (const Bar &bar, int n_samples, MagnifierDistribution dist=MagnifierDistribution::ENDPOINTS)
 Sample n_samples points along the OHLC price path of the bar.
 
void sample_price_path (const Bar &bar, int n_samples, MagnifierDistribution dist, std::vector< double > &out)
 Out-parameter overload of sample_price_path.
 
std::vector< double > sample_price_path_volume_weighted (const Bar &bar, int base_samples, double mean_volume, int min_samples=2, int max_samples=64, MagnifierDistribution dist=MagnifierDistribution::ENDPOINTS)
 Sample n_samples points along the OHLC price path, weighting the sample density by the ratio of this bar's volume to a reference mean_volume.
 
void sample_price_path_volume_weighted (const Bar &bar, int base_samples, double mean_volume, int min_samples, int max_samples, MagnifierDistribution dist, std::vector< double > &out)
 Out-parameter overload of sample_price_path_volume_weighted.
 
template<typename Key, typename Value>
bool is_na (const PineMap< Key, Value > &map) noexcept
 
bool native_bar_structurally_valid (const Bar &bar) noexcept
 Whether a bar can be admitted at all: finite positive OHLC with high >= max(open, close) and low <= min(open, close), and a finite nonnegative volume.
 
bool native_confirmed_bar_label_admitted (const native_calendar::NativeInterval &interval, int64_t timestamp) noexcept
 
int64_t native_canonical_input_completion (const native_calendar::NativeInterval &interval) noexcept
 
NativeInputPreflightResult preflight_native_inputs (const NativeRunSpec &spec, const Bar *bars, int n, NativeInputPolicy policy)
 Judge a whole bar array against a run spec before any of it is consumed, under NativeInputPolicy::Batch (sparse input is admitted; missing in-session slots are legal) or StreamWarmup (every provided slot must be a complete confirmed interval and an in-session gap is refused).
 
double deterministic_random (double lo, uint32_t call_site, double hi, uint32_t seed, int bar_index)
 
double pine_random (double lo, uint32_t call_site, double hi, uint32_t seed, int bar_index)
 
bool is_na (const NumericMatrix &matrix) noexcept
 
template<typename T>
T na ()
 
template<>
double na< double > ()
 
template<>
int na< int > ()
 
template<>
int64_t na< int64_t > ()
 
template<>
bool na< bool > ()
 
bool is_na (double v)
 
template<typename T, typename = std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>>>
bool is_na (T v)
 
template<class T>
bool is_na (const ScriptArray< T > &value)
 
bool is_na (const std::string &value)
 
template<typename T, std::enable_if_t< !std::is_arithmetic_v< T > &&!std::is_convertible_v< T, double > &&!std::is_convertible_v< T &, double > &&!std::is_convertible_v< const T &, double > &&!std::is_convertible_v< const T &, const std::string & >, int > = 0>
bool is_na (const T &value)
 
NativeInstrumentFeedReadView native_instrument_feed_view (const NativeInstrumentFeed &owned, const NativeInstrumentFeedView *borrowed) noexcept
 Common accessor for effective feed data.
 
NativeRunSpecValidation normalize_native_run_spec (NativeRunSpec &spec, const NativeBarViews &views) noexcept
 Existing full validation and zero-fee normalization over effective data.
 
NativeRunSpecValidation validate_native_instrument_feeds (const std::vector< NativeInstrumentFeed > &feeds, const NativeBarViews &views) noexcept
 The same feed-only validation over effective data, retaining all existing refusal ordering and typed catches.
 
NativeRunSpecValidation validate_native_timeframe_subscriptions (const std::vector< NativeTimeframeSubscription > &subscriptions, const std::string &input_tf, bool timeframe_undetected, const std::optional< NativeAuxiliaryFeed > &auxiliary_feed, const std::vector< NativeInstrumentFeed > &instrument_feeds, const NativeBarViews &views) noexcept
 The same feeds-first, auxiliary-feed, then subscription judgement over effective data, also at both begin declarations.
 
std::uint64_t native_instrument_feeds_digest (const std::vector< NativeInstrumentFeed > &feeds, const NativeBarViews &views) noexcept
 Same count, metadata, ordered OHLCV/timestamp/close/columns fold and feed NaN canonicalization.
 
std::uint64_t native_run_spec_digest (const NativeRunSpec &spec, const NativeBarViews &views)
 Portable spec fold with an explicit context, sharing the existing fold and relative run base; never infer external storage through a registry.
 
std::uint64_t native_intrabar_path_digest (const IntrabarPath &path, const NativeLowerPathSource *source)
 Null delegates to the vector digest; nonnull replaces only lower count/ walk.
 
NativeFxCurveValidation validate_native_fx_curve (const NativeFxCurve &curve) noexcept
 
std::uint64_t native_fx_curve_digest (const NativeFxCurve &curve) noexcept
 
constexpr std::uint8_t native_failure_context_bits (NativeFailureContextKind kind) noexcept
 The bit-union under NativeFailureContextKind: Cause=1, Recipient=2, Cursor=4.
 
constexpr bool native_failure_has_cause (NativeFailureContextKind kind) noexcept
 Whether a context of this kind populates its NativeInRunCause.
 
constexpr bool native_failure_has_recipient (NativeFailureContextKind kind) noexcept
 Whether a context of this kind populates its NativeInRunRecipient.
 
constexpr bool native_failure_has_cursor (NativeFailureContextKind kind) noexcept
 Whether a context of this kind populates its NativeInRunCursor.
 
constexpr bool native_failure_has_cause (const NativeFailureContext &context) noexcept
 Whether this context populates its NativeInRunCause.
 
constexpr bool native_failure_has_recipient (const NativeFailureContext &context) noexcept
 Whether this context populates its NativeInRunRecipient.
 
constexpr bool native_failure_has_cursor (const NativeFailureContext &context) noexcept
 Whether this context populates its NativeInRunCursor.
 
constexpr NativeFailureContextKind native_failure_context_kind (bool cause, bool recipient, bool cursor) noexcept
 The kind that says exactly these three alternatives are populated.
 
NativeFailureContext native_failure_cause (std::uint64_t ordinal) noexcept
 A context carrying one causing event ordinal.
 
NativeFailureContext native_failure_recipient (std::uint64_t incarnation) noexcept
 A context carrying one addressed request incarnation.
 
NativeFailureContext native_failure_cursor (NativeCoordinate point, double t=0.0) noexcept
 A context carrying one path cursor.
 
NativeFailureContext native_failure_context_in_run (const native_order::RunIdentity &run, const native_order::EventId *cause, const native_order::RequestHandle *recipient, const native_order::MatchCursor *cursor) noexcept
 Copies only ordinals/incarnation/cursor scalars.
 
const native_order::RunIdentity * native_failed_run_identity (const NativeFailed &failed) noexcept
 The RunIdentity the failed spec carried, or nullptr when configure failed before staging one.
 
constexpr bool native_feed_tolerance_enabled (NativeFeedTolerance enabled, NativeFeedTolerance requested) noexcept
 Whether one NativeFeedTolerance bit is set in a run's mask.
 
constexpr bool native_legacy_tolerance_enabled (NativeFeedTolerance enabled, NativeFeedTolerance requested) noexcept
 Deprecated spelling of native_feed_tolerance_enabled.
 
NativeRunSpecValidation validate_native_run_spec (const NativeRunSpec &spec) noexcept
 Complete validation, with deterministic first-error field order.
 
NativeRunSpecValidation normalize_native_run_spec (NativeRunSpec &spec) noexcept
 Validate the WHOLE value first, then canonicalize its admitted numeric negative zero (fee_value) to positive zero.
 
NativeRunSpecValidation validate_native_timeframe_subscriptions (const std::vector< NativeTimeframeSubscription > &subscriptions, const std::string &input_tf, bool timeframe_undetected) noexcept
 Exactly the part of validate_native_run_spec that judges declared higher-timeframe series, against a stated input timeframe: the pairing rule (as script_tf pairs, never strictly finer), the literals, the order of any authoritative bars, the one conflicting-feed refusal, and the undetected-timeframe rule.
 
NativeRunSpecValidation validate_native_timeframe_subscriptions (const std::vector< NativeTimeframeSubscription > &subscriptions, const std::string &input_tf, bool timeframe_undetected, const std::optional< NativeAuxiliaryFeed > &auxiliary_feed) noexcept
 The same judgement for a run that declares an auxiliary feed: the feed is judged first (validate_native_auxiliary_feed), then every series, a series built from the feed pairing with the FEED's timeframe.
 
NativeRunSpecValidation validate_native_timeframe_subscriptions (const std::vector< NativeTimeframeSubscription > &subscriptions, const std::string &input_tf, bool timeframe_undetected, const std::optional< NativeAuxiliaryFeed > &auxiliary_feed, const std::vector< NativeInstrumentFeed > &instrument_feeds) noexcept
 The same judgement for a run that also installs instrument feeds: the feeds are judged first (validate_native_instrument_feeds), then the auxiliary feed and every series, an InstrumentFeed series naming one of these feeds.
 
NativeRunSpecValidation validate_native_instrument_feeds (const std::vector< NativeInstrumentFeed > &instrument_feeds) noexcept
 Exactly the part of validate_native_run_spec that judges the instrument feeds: each key's strings and timeframe literal, the one-feed-per-key rule, and each feed's bars, closes and columns.
 
NativeRunSpecValidation validate_native_auxiliary_feed (const std::optional< NativeAuxiliaryFeed > &auxiliary_feed, const std::string &input_tf, bool timeframe_undetected) noexcept
 Exactly the part of validate_native_run_spec that judges the auxiliary feed, against a stated input timeframe: the literal, the strictly-finer pairing under the input, the order and structure of its bars, and the undetected-timeframe rule.
 
std::uint64_t native_intrabar_path_digest (const IntrabarPath &path) noexcept
 Exact FNV-1a content digest for a retained intrabar path.
 
std::uint64_t native_timeframe_subscriptions_digest (const std::vector< NativeTimeframeSubscription > &subscriptions) noexcept
 Exact FNV-1a content digest for the declared higher-timeframe series.
 
std::uint64_t native_auxiliary_feed_digest (const NativeAuxiliaryFeed &feed) noexcept
 Exact FNV-1a content digest for the declared auxiliary feed: its timeframe literal and every bar in caller order, so a continuation cannot silently reuse another begin's feed.
 
std::uint64_t native_instrument_feeds_digest (const std::vector< NativeInstrumentFeed > &instrument_feeds) noexcept
 Exact FNV-1a content digest for the installed instrument feeds: each key, every bar, close and column value in caller order, so a continuation cannot silently reuse another begin's feeds.
 
std::uint64_t native_run_spec_digest (const NativeRunSpec &spec) noexcept
 Machine-independent digest of a run spec: exactly the fields the consumer folds into the continuation identity for the spec, and nothing else — no timezone resources, no session identity beyond the spec's own.
 
std::uint64_t native_margin_model_digest (const NativeMarginModel &margin) noexcept
 Exact FNV-1a content digest for the generic margin model.
 
std::uint64_t native_risk_limits_digest (const NativeRiskLimits &risk) noexcept
 Exact FNV-1a content digest for the generic risk limits.
 
template<class T>
void observe_owned_storage (OwnedStorage &out, const T &value) noexcept
 
template<class... T>
void observe_owned_members (OwnedStorage &out, const T &... values) noexcept
 
RunFailureValue make_run_failure (RunFailureCode code, const RunFailureArgs &args) noexcept
 Validate args against code's registry entry and canonicalize them.
 
const char * run_failure_code_name (RunFailureCode code) noexcept
 The code's catalog name ("" for none or an unknown value).
 
RunFailureClass run_failure_code_class (RunFailureCode code) noexcept
 The code's catalog class and retryable flag.
 
bool run_failure_code_retryable (RunFailureCode code) noexcept
 
RunFailureValue classify_run_failure (const std::exception &error) noexcept
 The code an exception carries: a coded exception's own; else the safety net by type (std::bad_alloc -> out_of_memory, std::logic_error -> engine_invariant, other -> engine_unclassified_error).
 
void note_run_failure (BacktestEngine &engine, std::string text, RunFailureCode code, const RunFailureArgs &args={})
 
void note_run_failure (BacktestEngine &engine, const char *text, RunFailureCode code, const RunFailureArgs &args={})
 
void note_run_failure (BacktestEngine &engine, std::string text, const RunFailureValue &value)
 
void note_run_failure (BacktestEngine &engine, const char *entrypoint, const std::exception &error)
 
void note_run_failure_unknown (BacktestEngine &engine, const char *entrypoint)
 
void clear_run_failure (BacktestEngine &engine) noexcept
 
const char * run_failure_code_of (const BacktestEngine &engine) noexcept
 The getters' answers (strategy_get_last_error_code / _args): the stored code while its text is the engine's last error; engine_unclassified_error for a non-empty error no coded site wrote; "" when there is no failure.
 
const char * run_failure_args_of (const BacktestEngine &engine) noexcept
 
RunFailureValue run_failure_value_of (const BacktestEngine &engine) noexcept
 The recorded value under the same rule (none when there is no failure).
 
void pine_no_data_stop (const char *function, const char *call, std::int32_t line, const char *english)
 
void pine_other_symbol_stop (const char *function, const char *symbol_literal_or_null, const char *call, std::int32_t line, const char *english)
 
void pine_array_stop (const char *reason, const char *method_or_null, const char *english)
 
void pine_collection_stop (const char *collection, const char *reason, const char *english)
 
void pine_na_stop (const char *object, const char *english)
 
void pine_limit_stop (const char *limit, std::int64_t max, const char *english)
 
void pine_unsupported_stop (const char *reason, std::int32_t line, const char *english)
 
void pine_string_stop (const char *reason, const char *english)
 
void pine_engine_invariant (const char *english)
 
std::optional< RuntimeSubdivision > runtime_subdivision (const std::string &input_timeframe, const std::string &requested_timeframe)
 
std::vector< Bar > runtime_subdivide (const Bar &, RuntimeSubdivision)
 
void swap (ScriptString &a, ScriptString &b) noexcept
 
ScriptString operator+ (ScriptString a, const ScriptString &b)
 
ScriptString operator+ (ScriptString a, std::string_view b)
 
ScriptString operator+ (ScriptString a, const char *b)
 
ScriptString operator+ (ScriptString a, const std::string &b)
 
ScriptString operator+ (ScriptString a, char b)
 
ScriptString operator+ (std::string_view a, const ScriptString &b)
 
ScriptString operator+ (const std::string &a, const ScriptString &b)
 
ScriptString operator+ (const char *a, const ScriptString &b)
 
ScriptString operator+ (char a, const ScriptString &b)
 
bool operator== (const ScriptString &a, const ScriptString &b)
 
bool operator!= (const ScriptString &a, const ScriptString &b)
 
bool operator< (const ScriptString &a, const ScriptString &b)
 
bool operator> (const ScriptString &a, const ScriptString &b)
 
bool operator<= (const ScriptString &a, const ScriptString &b)
 
bool operator>= (const ScriptString &a, const ScriptString &b)
 
bool operator== (const ScriptString &a, std::string_view b)
 
bool operator== (std::string_view a, const ScriptString &b)
 
bool operator!= (const ScriptString &a, std::string_view b)
 
bool operator!= (std::string_view a, const ScriptString &b)
 
bool operator== (const ScriptString &a, const char *b)
 
bool operator== (const char *a, const ScriptString &b)
 
bool operator!= (const ScriptString &a, const char *b)
 
bool operator!= (const char *a, const ScriptString &b)
 
bool operator== (const ScriptString &a, const std::string &b)
 
bool operator== (const std::string &a, const ScriptString &b)
 
bool operator!= (const ScriptString &a, const std::string &b)
 
bool operator!= (const std::string &a, const ScriptString &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator< (const ScriptString &a, const Text &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator< (const Text &a, const ScriptString &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator> (const ScriptString &a, const Text &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator> (const Text &a, const ScriptString &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator<= (const ScriptString &a, const Text &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator<= (const Text &a, const ScriptString &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator>= (const ScriptString &a, const Text &b)
 
template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool operator>= (const Text &a, const ScriptString &b)
 
double str_tonumber (const ScriptString &)
 
SelectedPrimaryPlan plan_selected_primary (const Bar *rows, std::size_t count, const SelectedPlanRequest &request)
 
SelectedRetainedCount count_selected_retained_primary (const Bar *rows, std::size_t count, const SelectedRetainedRequest &request)
 
SelectedRetainedCount count_selected_executed_primary (const Bar *rows, std::size_t count, const SelectedRetainedRequest &request)
 
WindowCacheCapacity & window_cache_capacity ()
 
std::string normalize_timezone_for_posix (const std::string &tz)
 
int64_t timeframe_time (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &syminfo_tz=std::string())
 
int64_t timeframe_time_close (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &syminfo_tz=std::string())
 
int64_t timeframe_time (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &sym_tz, const std::string &sym_session)
 
int64_t timeframe_time_close (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &sym_tz, const std::string &sym_session)
 
int hhmm_to_minutes (const std::string &hhmm)
 
int local_hour (int64_t bar_ms, const std::string &tz)
 
int local_minute (int64_t bar_ms, const std::string &tz)
 
int local_second (int64_t bar_ms, const std::string &tz)
 
int local_dayofmonth (int64_t bar_ms, const std::string &tz)
 
int local_dayofweek (int64_t bar_ms, const std::string &tz)
 
int local_month (int64_t bar_ms, const std::string &tz)
 
int local_year (int64_t bar_ms, const std::string &tz)
 
int local_weekofyear (int64_t bar_ms, const std::string &tz)
 
bool local_time_in_session_windows (const std::string &windows_body, const struct tm &local_tm)
 
bool session_trades_at (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool passes_session_filter (const std::string &session, const std::string &tz, int64_t bar_ms)
 
int64_t calendar_day_open_local_ms (int64_t bar_ms, const std::string &tz)
 
int64_t session_trading_day_open_ms (int64_t bar_ms, const std::string &session, const std::string &tz)
 
bool session_in_market (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool session_in_premarket (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool session_in_postmarket (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool session_in_market (const std::string &session, const std::string &tz, int64_t bar_ms, const std::string &chart_tf)
 
bool session_in_premarket (const std::string &session, const std::string &tz, int64_t bar_ms, const std::string &chart_tf)
 
bool session_in_postmarket (const std::string &session, const std::string &tz, int64_t bar_ms, const std::string &chart_tf)
 
int64_t pine_time (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &syminfo_tz=std::string())
 
int64_t pine_time (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &sym_tz, const std::string &sym_session)
 
int64_t pine_time_close (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &syminfo_tz=std::string())
 
int64_t pine_time_close (int64_t bar_ms, const std::string &tf, const std::string &session, const std::string &tz, const std::string &chart_tf, const std::string &sym_tz, const std::string &sym_session)
 
int pine_hour (int64_t bar_ms, const std::string &tz)
 
int pine_minute (int64_t bar_ms, const std::string &tz)
 
int pine_second (int64_t bar_ms, const std::string &tz)
 
int pine_dayofmonth (int64_t bar_ms, const std::string &tz)
 
int pine_dayofweek (int64_t bar_ms, const std::string &tz)
 
int pine_month (int64_t bar_ms, const std::string &tz)
 
int pine_year (int64_t bar_ms, const std::string &tz)
 
int pine_weekofyear (int64_t bar_ms, const std::string &tz)
 
int64_t pine_time_tradingday (int64_t bar_ms, const std::string &session, const std::string &tz)
 
bool pine_session_ismarket (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool pine_session_ispremarket (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool pine_session_ispostmarket (const std::string &session, const std::string &tz, int64_t bar_ms)
 
bool pine_session_ismarket (const std::string &session, const std::string &tz, int64_t bar_ms, const std::string &chart_tf)
 
bool pine_session_ispremarket (const std::string &session, const std::string &tz, int64_t bar_ms, const std::string &chart_tf)
 
bool pine_session_ispostmarket (const std::string &session, const std::string &tz, int64_t bar_ms, const std::string &chart_tf)
 
bool pine_float_eq (double a, double b)
 
bool pine_float_ne (double a, double b)
 
bool pine_float_gt (double a, double b)
 
bool pine_float_lt (double a, double b)
 
bool pine_float_ge (double a, double b)
 
bool pine_float_le (double a, double b)
 
std::string str_format_values (const std::string &fmt, const std::vector< StrFormatValue > &args)
 
std::string str_format (const std::string &fmt, const std::vector< std::string > &args)
 
std::string str_format_time (long long timestamp_ms, const std::string &format, const std::string &timezone)
 
std::string str_match (const std::string &source, const std::string &regex_pattern)
 
std::vector< std::string > str_split (const std::string &source, const std::string &separator)
 
std::string str_tostring (double value, const std::string &format_mode="", double mintick=0.0)
 
ScriptString script_str_format_values (const ScriptString &, const std::vector< ScriptStrFormatValue > &)
 
ScriptString script_str_format (const ScriptString &, const std::vector< ScriptString > &)
 
ScriptString str_tostring (detail::o1::Store &, double value, const ScriptString &format_mode={}, double mintick=0.0)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptString str_format_values (Text &&format, const std::vector< ScriptStrFormatValue > &args)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptString str_format (Text &&format, const std::vector< ScriptString > &args)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts str_split (Text &&source, const ScriptString &separator)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts str_split (Text &&source, std::string_view separator)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts str_split (Text &&source, const char *separator)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts str_split (Text &&source, const std::string &separator)
 
std::string pine_str_format (const std::string &fmt, const std::vector< std::string > &args)
 
std::string pine_str_format_time (long long timestamp_ms, const std::string &format, const std::string &timezone)
 
std::string pine_str_match (const std::string &source, const std::string &regex_pattern)
 
std::vector< std::string > pine_str_split (const std::string &source, const std::string &separator)
 
std::string pine_str_tostring (double value, const std::string &format_mode="", double mintick=0.0)
 
template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptString pine_str_format (Text &&format, const std::vector< ScriptString > &args)
 
template<class Text, class Separator, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts pine_str_split (Text &&source, Separator &&separator)
 
ScriptString pine_str_tostring (detail::o1::Store &store, double value, const ScriptString &format={}, double mintick=0.0)
 
bool float_band_eq (double a, double b)
 
bool float_band_ne (double a, double b)
 
bool float_band_gt (double a, double b)
 
bool float_band_lt (double a, double b)
 
bool float_band_ge (double a, double b)
 
bool float_band_le (double a, double b)
 
int tf_to_seconds (const std::string &tf)
 Convert a TradingView timeframe string to seconds.
 
int tf_multiplier (const std::string &tf)
 Extract the numeric multiplier from a TF string (e.g. "15" -> 15, "D" -> 1).
 
bool tf_is_intraday (const std::string &tf)
 
bool tf_is_daily (const std::string &tf)
 
bool tf_is_weekly (const std::string &tf)
 
bool tf_is_monthly (const std::string &tf)
 
bool tf_is_seconds (const std::string &tf)
 
bool tf_change (int64_t prev_ms, int64_t curr_ms, const std::string &tf)
 Check if prev/curr timestamps cross a timeframe boundary.
 
int tf_ratio (const std::string &input_tf, const std::string &target_tf)
 Compute how many input bars fit into one target bar.
 
std::string detect_timeframe (const Bar *bars, int n, int max_samples=100)
 Detect the timeframe string from an array of bars by computing the median timestamp delta and mapping to the nearest standard TF.
 
CalendarPeriod calendar_period_for (const std::string &tf)
 Determine the calendar period for a target TF string.
 
bool tf_is_daily_or_higher (const std::string &tf)
 True for a daily-or-higher chart timeframe ("D", "1D", "2D", "W", "M"): a bar that covers whole session days rather than a time of day (the aggregation path's CALENDAR classification).
 
bool crosses_boundary (int64_t prev_ms, int64_t curr_ms, CalendarPeriod period)
 Check if two timestamps (Unix milliseconds) fall in different calendar periods.
 
bool crosses_boundary (int64_t prev_ms, int64_t curr_ms, CalendarPeriod period, const std::string &tz, const std::string &session)
 Timezone/session-aware variants.
 
bool tf_change (int64_t prev_ms, int64_t curr_ms, const std::string &tf, const std::string &tz, const std::string &session)
 
int64_t session_day_index (int64_t ms, const std::string &tz, const std::string &session)
 Ordinal of the session day containing ms (days since epoch on the session clock).
 
int64_t session_period_open_ms (int64_t ms, const std::string &tz, const std::string &session, CalendarPeriod period)
 Open (Unix ms) of the symbol's D/W/M bar that contains ms: the day stamp of the period's first session-day (17:00 ET on OANDA 1800-1700, the session open elsewhere).
 
int64_t session_intraday_bucket_open_ms (int64_t ms, int64_t bucket_sec, const std::string &tz, const std::string &session)
 Open (Unix ms) of the bucket_sec-wide intraday bucket that contains ms on the symbol's day-stamp-anchored grid: time WITHIN the session day, floored to the bucket width.
 
int64_t session_intraday_bucket_end_ms (int64_t ms, int64_t bucket_sec, const std::string &tz, const std::string &session)
 Exclusive end from the SAME intraday boundary writer as the open seam.
 
int64_t session_covered_instant_ms (int64_t ms, const std::string &tz, const std::string &session)
 The session instant a native CALENDAR chart stamp covers.
 
int64_t session_period_close_ms (int64_t ms, const std::string &tz, const std::string &session, CalendarPeriod period)
 Exclusive close (Unix ms) of the symbol's D/W/M bar that contains ms: DAY -> session-day open + session length (16:00 ET on equities, the next 17:00 ET on forex, next midnight on 24x7); WEEK / MONTH -> the open of the next period's first session-day.
 
int64_t session_period_last_traded_close_ms (int64_t ms, const std::string &tz, const std::string &session, CalendarPeriod period)
 Exclusive close (Unix ms) of the LAST TRADED session-day of the D/W/M bar that contains ms: DAY is session_period_close_ms; WEEK / MONTH step back from the period's last session-day over weekend TRADING dates (Saturday / Sunday never hold a session on exchange-calendar symbols), so an equity week ends Friday 16:00 ET, a month whose last calendar day is a weekend ends on its last Friday, and the forex week ends Friday 17:00 ET (the Friday-open session is Saturday's trading date).
 
std::vector< int64_t > native_late_day_opens (const std::string &tz, const std::string &session, const std::vector< int64_t > &stamps, const Bar *input_bars, int n_input)
 The native daily stamps that open their session-day LATE: a stamp after the day stamp of the (nominal) session-day holding it and before that day's scheduled close, with no input bar between the day stamp and the stamp – the day's first trade is the stamp itself, hours after the session template's open (NSE's Muhurat session of 2025-10-21, 13:45 IST).
 
bool build_native_day_partition (NativeDayPartition &out, const std::string &tz, const std::string &session, const std::vector< int64_t > &stamps, const Bar *input_bars, int n_input, const std::string &scratch_directory={})
 Build the partition for the symbol clock (tz, session) from the native daily stamps and the chart's input bars (the trade instants: the last input bar before the next stamp, bounded by the last stamp's nominal session-day close; the stamp itself when no input bar lies in the period).
 
bool build_native_day_partition (NativeDayPartition &out, const std::string &tz, const std::string &session, const std::vector< int64_t > &stamps, const Bar *input_bars, int n_input, std::size_t projection_cache_bytes, const std::string &scratch_directory={})
 As above, with an inclusive optional cache budget for EACH of the three projection columns.
 
int native_day_partition_index (const NativeDayPartition &p, int64_t ms)
 Index of the native period holding ms under p: -1 before the first stamp and at / after the last stamp's nominal session-day close.
 
const NativeDayPartition * set_active_native_day_partition (const NativeDayPartition *p)
 The calling thread's active chart partition, read by session_day_index / session_period_open_ms / session_period_close_ms / session_period_last_traded_close_ms / crosses_boundary (and so by tf_change, the symbol-clock pine_time forms and ta::VWAP's session anchor) whenever their (tz, session) equal the partition's.
 
const NativeDayPartition * active_native_day_partition ()
 
static int safe_tf_to_seconds (const std::string &tf)
 
static bool same_bar_exit_group_possible (const TradeLedger &trades)
 

Variables

constexpr std::size_t kReportSinkHeldEquityPoints = 1
 
template<typename T>
constexpr bool is_pine_map_snapshot_value_v
 
constexpr const char * kNativeDriverSemanticVersion = "native-driver/v5"
 
constexpr const char * kNativeConsumerSemanticVersion = "native-consumer/v9"
 
constexpr const char * kNativeCalendarSemanticVersion = "native-calendar/v1"
 
constexpr std::uint16_t kRunFailureCodeCount = 88
 
constexpr double kPineFloatEqualityBand = kFloatCompareBand
 
constexpr double kFloatCompareBand = 1e-10
 
constexpr int64_t kSecPerDay = 86400
 
constexpr int64_t kMsPerDay = 86400000
 

Typedef Documentation

◆ PineExitActivationPolicy

◆ PineHistoricalBirthReach

◆ LotExcursionHook

Definition at line 136 of file engine.hpp.

◆ ExitLegLifecycle

Definition at line 469 of file engine.hpp.

◆ InputsMap

using pineforge::InputsMap = std::unordered_map<std::string, std::string>

Definition at line 503 of file engine.hpp.

◆ PineGenericMatrix

template<typename T>
using pineforge::PineGenericMatrix = GenericMatrix<T>

Definition at line 820 of file generic_matrix.hpp.

◆ PineMatrix

Definition at line 159 of file matrix.hpp.

◆ RunFailureArgs

Definition at line 218 of file run_failure.hpp.

◆ MarketAdmissionDraft

◆ MarketAdmissionJournal

Enumeration Type Documentation

◆ XLoc

enum class pineforge::XLoc : int
strong
Enumerator
bar_index 
bar_time 

Definition at line 48 of file drawing.hpp.

◆ YLoc

enum class pineforge::YLoc : int
strong
Enumerator
price 
abovebar 
belowbar 

Definition at line 49 of file drawing.hpp.

◆ DrawingKind

enum class pineforge::DrawingKind : std::uint8_t
strong
Enumerator
line 
box 
label 
linefill 

Definition at line 85 of file drawing.hpp.

◆ DrawingAccessStatus

enum class pineforge::DrawingAccessStatus : std::uint8_t
strong
Enumerator
invalid 
stale 
present 

Definition at line 86 of file drawing.hpp.

◆ DrawingAllocationStatus

enum class pineforge::DrawingAllocationStatus : std::uint8_t
strong
Enumerator
ok 
drawing_slot_bound_exceeded 
pine_drawing_id_exhausted 

Definition at line 91 of file drawing.hpp.

◆ PositionSide

enum class pineforge::PositionSide
strong
Enumerator
FLAT 
LONG 
SHORT 

Definition at line 66 of file engine.hpp.

◆ OpenedLotFillPoint

enum class pineforge::OpenedLotFillPoint : std::uint8_t
strong
Enumerator
OnPath 
AfterPath 

Definition at line 147 of file engine.hpp.

◆ ReportMode

enum class pineforge::ReportMode : std::uint32_t
strong
Enumerator
FULL 
SUMMARY_ONLY 
STREAMED 

Definition at line 320 of file engine.hpp.

◆ QtyType

enum class pineforge::QtyType
strong
Enumerator
FIXED 
PERCENT_OF_EQUITY 
CASH 

Definition at line 472 of file engine.hpp.

◆ CommissionType

enum class pineforge::CommissionType
strong
Enumerator
PERCENT 
CASH_PER_ORDER 
CASH_PER_CONTRACT 

Definition at line 475 of file engine.hpp.

◆ MagnifierDistribution

Enumerator
UNIFORM 
COSINE 
TRIANGLE 
ENDPOINTS 
FRONT_LOADED 
BACK_LOADED 

Definition at line 7 of file magnifier.hpp.

◆ BirthCursorDomain

enum class pineforge::BirthCursorDomain : int32_t
strong
Enumerator
None 
HistoricalPath 
MagnifierTicks 

Definition at line 10 of file order_birth.hpp.

◆ BirthCursorPosition

enum class pineforge::BirthCursorPosition : int32_t
strong
Enumerator
None 
Point 
Segment 

Definition at line 11 of file order_birth.hpp.

◆ OrderBirthCause

enum class pineforge::OrderBirthCause : int32_t
strong
Enumerator
Unattributed 
DirectCommand 
ChartEvaluation 
FillEvaluation 

Definition at line 12 of file order_birth.hpp.

◆ OwnedStorageUnsupported

enum class pineforge::OwnedStorageUnsupported : std::uint64_t
strong
Enumerator
opaque_type 
allocator 
scratch_file 
exception_state 
legacy_evaluator 
observation_allocation 
scratch_extent 
scratch_quota_endpoint 
scratch_arena 
scratch_slab 

Definition at line 26 of file owned_storage.hpp.

◆ QuantityIntentKind

enum class pineforge::QuantityIntentKind
strong
Enumerator
Units 
Fraction 
All 

Definition at line 10 of file quantity_intent.hpp.

◆ RunFailureClass

enum class pineforge::RunFailureClass : std::uint8_t
strong

The class a code belongs to (the catalog's class).

Enumerator
strategy 
strategy_limit 
no_data 
symbol_metadata 
symbol_feeds 
input 
unsupported 
resource 
engine_fault 

Definition at line 146 of file run_failure.hpp.

◆ RunFailureArgKind

enum class pineforge::RunFailureArgKind : std::uint8_t
strong

An argument's kind (the catalog's kind).

Enumerator
identifier 
keyword 
vocab 
integer 
number 
pine_source 
symbol 
timeframe 
string 
nullable_string 
scalar 
boolean 

Definition at line 159 of file run_failure.hpp.

◆ RunFailureCode

enum class pineforge::RunFailureCode : std::uint16_t
strong
Enumerator
none 
chart_bars_rejected 
chart_bars_unreadable 
engine_command_value_invalid 
engine_invariant 
engine_unclassified_error 
harness_internal_error 
lot_grid_rejected 
no_data_request 
other_symbol_feed_missing 
other_symbol_request 
out_of_memory 
outputs_limit 
outputs_rejected 
pine_array_error 
pine_invalid_argument 
pine_matrix_error 
pine_na_reference 
pine_runtime_limit 
pine_string_error 
recalc_cap 
recorded_request_missing 
recorded_request_refused 
report_platform_unavailable 
report_post_execution_failed 
report_result_invalid 
report_shape_request_invalid 
report_shape_unsupported 
request_symbol_invalid 
request_timeframe_invalid 
request_timeframe_unsupported 
request_unsupported 
results_digest_unsupported 
run_aborted 
run_mode_unsupported 
run_options_rejected 
run_request_invalid 
security_feed_refused 
setting_rejected 
setting_unsupported 
strategy_create_failed 
strategy_library_incompatible 
strategy_runtime_error 
strategy_settings_rejected 
strategy_value_invalid 
stream_input_rejected 
symbol_feeds_refused 
symbol_metadata_rejected 
syminfo_unreadable 
window_boundary_unaligned 
window_calendar_unsupported 
window_feed_identity_changed 
window_feed_range_invalid 
window_input_cap_exceeded 
window_legacy_flag_conflict 
window_lineage_mismatch 
window_mode_unsupported 
window_no_observations 
window_preroll_out_of_range 
window_prestart_fill 
window_prestart_state_violation 
window_pruner_unsupported 
window_range_invalid 
window_report_mismatch 
window_request_invalid 
report_mode_unsupported 
report_sink_failed 
scratch_capacity_exceeded 
scratch_configuration_invalid 
scratch_io_failed 
diagnostic_budget_exceeded 
report_budget_exceeded 
report_channel_failed 
run_deadline_exceeded 
run_descriptor_limit_exceeded 
run_isolation_unavailable 
run_process_refused 
run_producer_failed 
run_quota_configuration_invalid 
run_resource_quota_exceeded 
runtime_history_budget_exhausted 
runtime_storage_observation_incomplete 
pine_map_capacity_exceeded 
selected_auxiliary_rows_limit_exceeded 
selected_bytes_limit_exceeded 
selected_primary_rows_limit_exceeded 
selected_script_bars_limit_exceeded 
selected_source_rows_limit_exceeded 

Definition at line 14 of file run_failure_codes.hpp.

◆ CalendarPeriod

enum class pineforge::CalendarPeriod
strong
Enumerator
NONE 
DAY 
WEEK 
MONTH 

Definition at line 81 of file timeframe.hpp.

Function Documentation

◆ is_na() [1/13]

◆ is_na() [2/13]

bool pineforge::is_na ( const Box & h)
inline

Definition at line 59 of file drawing.hpp.

References pineforge::Box::id.

◆ is_na() [3/13]

bool pineforge::is_na ( const Label & h)
inline

Definition at line 60 of file drawing.hpp.

References pineforge::Label::id.

◆ is_na() [4/13]

bool pineforge::is_na ( const Linefill & h)
inline

Definition at line 61 of file drawing.hpp.

References pineforge::Linefill::id.

◆ is_na() [5/13]

bool pineforge::is_na ( const ChartPoint & p)
inline

◆ drawing_bound()

DrawingBoundConfig pineforge::drawing_bound ( std::int32_t slot_bound,
std::uint32_t pending_creation_slots = 1 )
inline

Definition at line 561 of file drawing.hpp.

References engine_invariant.

Referenced by pineforge::detail::drawing_bound_from_linefill_sample().

◆ drawing_bound_from_declared_count()

template<class Rec>
DrawingBoundConfig pineforge::drawing_bound_from_declared_count ( std::int32_t declared_count = 50,
std::uint32_t pending_creation_slots = 1 )
inline

◆ drawing_bound_from_linefill_sample()

DrawingBoundConfig pineforge::drawing_bound_from_linefill_sample ( std::int32_t sampled_bound = detail::kDrawingLinefillObservedBound,
std::uint32_t pending_creation_slots = 1 )
inline

◆ pf_require_live() [1/2]

template<class Rec, class Handle>
Rec & pineforge::pf_require_live ( DrawingArena< Rec > & a,
Handle h )
inline

◆ pf_require_live() [2/2]

template<class Rec, class Handle>
const Rec & pineforge::pf_require_live ( const DrawingArena< Rec > & a,
Handle h )
inline

◆ pf_point_x()

◆ pf_line_new()

Line pineforge::pf_line_new ( DrawingArena< LineRec > & a,
int64_t x1,
double y1,
int64_t x2,
double y2,
XLoc xloc = XLoc::bar_index,
bool el = false,
bool er = false )
inline

Definition at line 1079 of file drawing.hpp.

References bar_index, and pineforge::detail::drawing_builtin_allocate().

◆ pf_line_new_pts()

Line pineforge::pf_line_new_pts ( DrawingArena< LineRec > & a,
ChartPoint p1,
ChartPoint p2,
XLoc xloc = XLoc::bar_index )
inline

◆ pf_line_get_x1()

int64_t pineforge::pf_line_get_x1 ( DrawingArena< LineRec > & a,
Line h )
inline

Definition at line 1092 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_line_get_x2()

int64_t pineforge::pf_line_get_x2 ( DrawingArena< LineRec > & a,
Line h )
inline

Definition at line 1093 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_line_get_y1()

double pineforge::pf_line_get_y1 ( DrawingArena< LineRec > & a,
Line h )
inline

Definition at line 1094 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_line_get_y2()

double pineforge::pf_line_get_y2 ( DrawingArena< LineRec > & a,
Line h )
inline

Definition at line 1095 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_line_set_x1()

void pineforge::pf_line_set_x1 ( DrawingArena< LineRec > & a,
Line h,
int64_t v )
inline

Definition at line 1097 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_set_x2()

void pineforge::pf_line_set_x2 ( DrawingArena< LineRec > & a,
Line h,
int64_t v )
inline

Definition at line 1098 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_set_y1()

void pineforge::pf_line_set_y1 ( DrawingArena< LineRec > & a,
Line h,
double v )
inline

Definition at line 1099 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_set_y2()

void pineforge::pf_line_set_y2 ( DrawingArena< LineRec > & a,
Line h,
double v )
inline

Definition at line 1100 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_set_xy1()

void pineforge::pf_line_set_xy1 ( DrawingArena< LineRec > & a,
Line h,
int64_t x,
double y )
inline

Definition at line 1101 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_set_xy2()

void pineforge::pf_line_set_xy2 ( DrawingArena< LineRec > & a,
Line h,
int64_t x,
double y )
inline

Definition at line 1104 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_set_first_point()

void pineforge::pf_line_set_first_point ( DrawingArena< LineRec > & a,
Line h,
ChartPoint p )
inline

◆ pf_line_set_second_point()

void pineforge::pf_line_set_second_point ( DrawingArena< LineRec > & a,
Line h,
ChartPoint p )
inline

◆ pf_line_set_xloc()

void pineforge::pf_line_set_xloc ( DrawingArena< LineRec > & a,
Line h,
int64_t x1,
int64_t x2,
XLoc xloc )
inline

Definition at line 1113 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_line_get_price()

◆ pf_line_copy()

◆ pf_line_delete()

void pineforge::pf_line_delete ( DrawingArena< LineRec > & a,
Line h )
inline

Definition at line 1135 of file drawing.hpp.

References pineforge::DrawingArena< Rec >::erase(), and pineforge::Line::id.

◆ pf_box_new()

Box pineforge::pf_box_new ( DrawingArena< BoxRec > & a,
int64_t left,
double top,
int64_t right,
double bottom,
XLoc xloc = XLoc::bar_index )
inline

Definition at line 1138 of file drawing.hpp.

References bar_index, and pineforge::detail::drawing_builtin_allocate().

◆ pf_box_new_pts()

Box pineforge::pf_box_new_pts ( DrawingArena< BoxRec > & a,
ChartPoint top_left,
ChartPoint bottom_right,
XLoc xloc = XLoc::bar_index )
inline

◆ pf_box_get_left()

int64_t pineforge::pf_box_get_left ( DrawingArena< BoxRec > & a,
Box h )
inline

Definition at line 1150 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_box_get_right()

int64_t pineforge::pf_box_get_right ( DrawingArena< BoxRec > & a,
Box h )
inline

Definition at line 1151 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_box_get_top()

double pineforge::pf_box_get_top ( DrawingArena< BoxRec > & a,
Box h )
inline

Definition at line 1152 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_box_get_bottom()

double pineforge::pf_box_get_bottom ( DrawingArena< BoxRec > & a,
Box h )
inline

Definition at line 1153 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_box_set_left()

void pineforge::pf_box_set_left ( DrawingArena< BoxRec > & a,
Box h,
int64_t v )
inline

Definition at line 1155 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_set_right()

void pineforge::pf_box_set_right ( DrawingArena< BoxRec > & a,
Box h,
int64_t v )
inline

Definition at line 1156 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_set_top()

void pineforge::pf_box_set_top ( DrawingArena< BoxRec > & a,
Box h,
double v )
inline

Definition at line 1157 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_set_bottom()

void pineforge::pf_box_set_bottom ( DrawingArena< BoxRec > & a,
Box h,
double v )
inline

Definition at line 1158 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_set_lefttop()

void pineforge::pf_box_set_lefttop ( DrawingArena< BoxRec > & a,
Box h,
int64_t left,
double top )
inline

Definition at line 1159 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_set_rightbottom()

void pineforge::pf_box_set_rightbottom ( DrawingArena< BoxRec > & a,
Box h,
int64_t right,
double bottom )
inline

Definition at line 1162 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_set_top_left_point()

void pineforge::pf_box_set_top_left_point ( DrawingArena< BoxRec > & a,
Box h,
ChartPoint p )
inline

◆ pf_box_set_bottom_right_point()

void pineforge::pf_box_set_bottom_right_point ( DrawingArena< BoxRec > & a,
Box h,
ChartPoint p )
inline

◆ pf_box_set_xloc()

void pineforge::pf_box_set_xloc ( DrawingArena< BoxRec > & a,
Box h,
int64_t left,
int64_t right,
XLoc xloc )
inline

Definition at line 1171 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_box_copy()

◆ pf_box_delete()

void pineforge::pf_box_delete ( DrawingArena< BoxRec > & a,
Box h )
inline

Definition at line 1181 of file drawing.hpp.

References pineforge::DrawingArena< Rec >::erase(), and pineforge::Box::id.

◆ pf_label_new()

Label pineforge::pf_label_new ( DrawingArena< LabelRec > & a,
int64_t x,
double y,
std::string text,
XLoc xloc = XLoc::bar_index,
YLoc yloc = YLoc::price )
inline

Definition at line 1190 of file drawing.hpp.

References bar_index, pineforge::detail::drawing_builtin_allocate(), and price.

◆ pf_label_new_pt()

◆ pf_label_get_x()

int64_t pineforge::pf_label_get_x ( DrawingArena< LabelRec > & a,
Label h )
inline

Definition at line 1204 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_label_get_y()

double pineforge::pf_label_get_y ( DrawingArena< LabelRec > & a,
Label h )
inline

Definition at line 1205 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_label_get_text()

std::string pineforge::pf_label_get_text ( DrawingArena< LabelRec > & a,
Label h )
inline

Definition at line 1206 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_label_set_x()

void pineforge::pf_label_set_x ( DrawingArena< LabelRec > & a,
Label h,
int64_t v )
inline

Definition at line 1208 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_label_set_y()

void pineforge::pf_label_set_y ( DrawingArena< LabelRec > & a,
Label h,
double v )
inline

Definition at line 1209 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_label_set_xy()

void pineforge::pf_label_set_xy ( DrawingArena< LabelRec > & a,
Label h,
int64_t x,
double y )
inline

Definition at line 1210 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_label_set_point()

void pineforge::pf_label_set_point ( DrawingArena< LabelRec > & a,
Label h,
ChartPoint p )
inline

◆ pf_label_set_xloc()

void pineforge::pf_label_set_xloc ( DrawingArena< LabelRec > & a,
Label h,
int64_t x,
XLoc xloc )
inline

Definition at line 1216 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_label_set_yloc()

void pineforge::pf_label_set_yloc ( DrawingArena< LabelRec > & a,
Label h,
YLoc yloc )
inline

Definition at line 1219 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_label_set_text()

void pineforge::pf_label_set_text ( DrawingArena< LabelRec > & a,
Label h,
std::string text )
inline

Definition at line 1222 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::edit().

◆ pf_label_copy()

◆ pf_label_delete()

void pineforge::pf_label_delete ( DrawingArena< LabelRec > & a,
Label h )
inline

Definition at line 1232 of file drawing.hpp.

References pineforge::DrawingArena< Rec >::erase(), and pineforge::Label::id.

◆ pf_linefill_new()

Linefill pineforge::pf_linefill_new ( DrawingArena< LinefillRec > & a,
Line l1,
Line l2 )
inline

Definition at line 1235 of file drawing.hpp.

References pineforge::DrawingArena< Rec >::alloc(), and pineforge::Line::id.

◆ pf_linefill_get_line1()

Line pineforge::pf_linefill_get_line1 ( DrawingArena< LinefillRec > & a,
Linefill h )
inline

Definition at line 1240 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_linefill_get_line2()

Line pineforge::pf_linefill_get_line2 ( DrawingArena< LinefillRec > & a,
Linefill h )
inline

Definition at line 1243 of file drawing.hpp.

References pineforge::detail::DrawingBuiltinAccess::read().

◆ pf_linefill_delete()

void pineforge::pf_linefill_delete ( DrawingArena< LinefillRec > & a,
Linefill h )
inline

◆ pf_noop()

template<class... A>
void pineforge::pf_noop ( A && ...)
inline

Definition at line 1251 of file drawing.hpp.

◆ is_na() [6/13]

template<typename T>
bool pineforge::is_na ( const GenericMatrix< T > & matrix)
inlinenoexcept

Definition at line 811 of file generic_matrix.hpp.

◆ pine_log_info()

void pineforge::pine_log_info ( const std::string & msg)
inline

Definition at line 9 of file log.hpp.

◆ pine_log_warning()

void pineforge::pine_log_warning ( const std::string & msg)
inline

Definition at line 10 of file log.hpp.

◆ pine_log_error()

void pineforge::pine_log_error ( const std::string & msg)
inline

Definition at line 11 of file log.hpp.

◆ pine_runtime_error()

void pineforge::pine_runtime_error ( const std::string & msg)
inline

Definition at line 14 of file log.hpp.

References strategy_runtime_error.

◆ path_at()

double pineforge::path_at ( double t,
double p0,
double p1,
double p2,
double p3,
double len0,
double len1,
double len2,
double total )

Maps parameter t in [0,1] to a price on the 3-segment path.

Segments: p0->p1, p1->p2, p2->p3 with arc lengths len0, len1, len2.

◆ sample_price_path() [1/2]

std::vector< double > pineforge::sample_price_path ( const Bar & bar,
int n_samples,
MagnifierDistribution dist = MagnifierDistribution::ENDPOINTS )

Sample n_samples points along the OHLC price path of the bar.

The first leg follows TradingView-style open proximity: O -> H -> L -> C when open is nearer high, otherwise O -> L -> H -> C (ties low-first). First sample is always O, last is always C. Minimum 2 samples.

References ENDPOINTS.

◆ sample_price_path() [2/2]

void pineforge::sample_price_path ( const Bar & bar,
int n_samples,
MagnifierDistribution dist,
std::vector< double > & out )

Out-parameter overload of sample_price_path.

Writes the sampled prices into out (cleared first; retained capacity is reused), avoiding a per-call heap allocation in hot sampling loops. Behaviour is identical to the value-returning overload.

◆ sample_price_path_volume_weighted() [1/2]

std::vector< double > pineforge::sample_price_path_volume_weighted ( const Bar & bar,
int base_samples,
double mean_volume,
int min_samples = 2,
int max_samples = 64,
MagnifierDistribution dist = MagnifierDistribution::ENDPOINTS )

Sample n_samples points along the OHLC price path, weighting the sample density by the ratio of this bar's volume to a reference mean_volume.

A bar with 2x average volume receives up to 2x as many samples as a bar at average volume, clamped within [min_samples, max_samples].

Intended for magnifier modes that should simulate denser tick streams when volume is higher (more trades per bar → more fill opportunities).

References ENDPOINTS.

◆ sample_price_path_volume_weighted() [2/2]

void pineforge::sample_price_path_volume_weighted ( const Bar & bar,
int base_samples,
double mean_volume,
int min_samples,
int max_samples,
MagnifierDistribution dist,
std::vector< double > & out )

Out-parameter overload of sample_price_path_volume_weighted.

Writes into out (cleared first; retained capacity reused). Behaviour is identical to the value-returning overload.

◆ is_na() [7/13]

template<typename Key, typename Value>
bool pineforge::is_na ( const PineMap< Key, Value > & map)
inlinenoexcept

Definition at line 1543 of file map.hpp.

References is_na().

◆ deterministic_random()

double pineforge::deterministic_random ( double lo,
uint32_t call_site,
double hi,
uint32_t seed,
int bar_index )
inline

Definition at line 9 of file math.hpp.

References bar_index.

Referenced by pine_random().

◆ pine_random()

double pineforge::pine_random ( double lo,
uint32_t call_site,
double hi,
uint32_t seed,
int bar_index )
inline

Definition at line 24 of file math.hpp.

References bar_index, and deterministic_random().

◆ is_na() [8/13]

bool pineforge::is_na ( const NumericMatrix & matrix)
inlinenoexcept

Definition at line 151 of file matrix.hpp.

◆ na()

◆ na< double >()

◆ na< int >()

◆ na< int64_t >()

◆ na< bool >()

template<>
bool pineforge::na< bool > ( )
inline

Definition at line 67 of file na.hpp.

◆ is_na() [9/13]

bool pineforge::is_na ( double v)
inline

Definition at line 69 of file na.hpp.

◆ is_na() [10/13]

template<typename T, typename = std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>>>
bool pineforge::is_na ( T v)
inline

Definition at line 73 of file na.hpp.

◆ is_na() [11/13]

template<class T>
bool pineforge::is_na ( const ScriptArray< T > & value)
inline

Definition at line 81 of file na.hpp.

◆ is_na() [12/13]

bool pineforge::is_na ( const std::string & value)
inline

Definition at line 94 of file na.hpp.

◆ is_na() [13/13]

template<typename T, std::enable_if_t< !std::is_arithmetic_v< T > &&!std::is_convertible_v< T, double > &&!std::is_convertible_v< T &, double > &&!std::is_convertible_v< const T &, double > &&!std::is_convertible_v< const T &, const std::string & >, int > = 0>
bool pineforge::is_na ( const T & value)
inline

Definition at line 110 of file na.hpp.

References pineforge::na_detail::call_adl_is_na().

◆ observe_owned_storage()

◆ observe_owned_members()

template<class... T>
void pineforge::observe_owned_members ( OwnedStorage & out,
const T &... values )
noexcept

Definition at line 263 of file owned_storage.hpp.

References observe_owned_storage().

Referenced by pineforge::OwnedStorageTraits< std::pair< A, B > >::observe(), pineforge::OwnedStorageTraits< std::tuple< T... > >::observe(), pineforge::OwnedStorageTraits< std::unordered_map< K, V, H, E, A > >::observe(), pineforge::KahanWindowSum::observe_owned_storage(), pineforge::source::multi_day_detail::Params::observe_owned_storage(), pineforge::source::multi_day_detail::RescannedSource::observe_owned_storage(), pineforge::source::multi_day_detail::Source::observe_owned_storage(), pineforge::source::SeriesPercentileNearestRank::observe_owned_storage(), pineforge::ta::ALMA::observe_owned_storage(), pineforge::ta::AnchoredVWAPBands::observe_owned_storage(), pineforge::ta::ATR::observe_owned_storage(), pineforge::ta::BB::observe_owned_storage(), pineforge::ta::BBW::observe_owned_storage(), pineforge::ta::CCI::observe_owned_storage(), pineforge::ta::Change::observe_owned_storage(), pineforge::ta::CMO::observe_owned_storage(), pineforge::ta::COG::observe_owned_storage(), pineforge::ta::Correlation::observe_owned_storage(), pineforge::ta::Dev::observe_owned_storage(), pineforge::ta::DMI::observe_owned_storage(), pineforge::ta::ExtremeRing::observe_owned_storage(), pineforge::ta::Falling::observe_owned_storage(), pineforge::ta::Highest::observe_owned_storage(), pineforge::ta::HighestBars::observe_owned_storage(), pineforge::ta::HMA::observe_owned_storage(), pineforge::ta::KC::observe_owned_storage(), pineforge::ta::KCW::observe_owned_storage(), pineforge::ta::Linreg::observe_owned_storage(), pineforge::ta::Lowest::observe_owned_storage(), pineforge::ta::LowestBars::observe_owned_storage(), pineforge::ta::MACD::observe_owned_storage(), pineforge::ta::Median::observe_owned_storage(), pineforge::ta::MFI::observe_owned_storage(), pineforge::ta::Mode::observe_owned_storage(), pineforge::ta::Mom::observe_owned_storage(), pineforge::ta::PercentileLinearInterpolation::observe_owned_storage(), pineforge::ta::PercentileNearestRank::observe_owned_storage(), pineforge::ta::PercentileWindow::observe_owned_storage(), pineforge::ta::PercentRank::observe_owned_storage(), pineforge::ta::PivotHigh::observe_owned_storage(), pineforge::ta::PivotLow::observe_owned_storage(), pineforge::ta::Range::observe_owned_storage(), pineforge::ta::RCI::observe_owned_storage(), pineforge::ta::Rising::observe_owned_storage(), pineforge::ta::ROC::observe_owned_storage(), pineforge::ta::RSI::observe_owned_storage(), pineforge::ta::SMA::observe_owned_storage(), pineforge::ta::StdDev::observe_owned_storage(), pineforge::ta::Stoch::observe_owned_storage(), pineforge::ta::Supertrend::observe_owned_storage(), pineforge::ta::SWMA::observe_owned_storage(), pineforge::ta::TSI::observe_owned_storage(), pineforge::ta::ValueWhen::observe_owned_storage(), pineforge::ta::Variance::observe_owned_storage(), pineforge::ta::VWAPBands::observe_owned_storage(), pineforge::ta::VWMA::observe_owned_storage(), pineforge::ta::WMA::observe_owned_storage(), and pineforge::ta::WPR::observe_owned_storage().

◆ make_run_failure()

RunFailureValue pineforge::make_run_failure ( RunFailureCode code,
const RunFailureArgs & args )
noexcept

Validate args against code's registry entry and canonicalize them.

Any violation yields engine_invariant without arguments. Allocation failure yields out_of_memory.

Referenced by pineforge::native_module::run_backtest_full(), and pineforge::source::run_spec_field_failure().

◆ run_failure_code_name()

const char * pineforge::run_failure_code_name ( RunFailureCode code)
noexcept

The code's catalog name ("" for none or an unknown value).

◆ run_failure_code_class()

RunFailureClass pineforge::run_failure_code_class ( RunFailureCode code)
noexcept

The code's catalog class and retryable flag.

◆ run_failure_code_retryable()

bool pineforge::run_failure_code_retryable ( RunFailureCode code)
noexcept

◆ classify_run_failure()

RunFailureValue pineforge::classify_run_failure ( const std::exception & error)
noexcept

The code an exception carries: a coded exception's own; else the safety net by type (std::bad_alloc -> out_of_memory, std::logic_error -> engine_invariant, other -> engine_unclassified_error).

Referenced by pineforge::native_module::guarded(), pineforge::source::PineStrategyHost::on_native_run_begin(), and pineforge::native_module::run_batch().

◆ note_run_failure() [1/4]

◆ note_run_failure() [2/4]

void pineforge::note_run_failure ( BacktestEngine & engine,
const char * text,
RunFailureCode code,
const RunFailureArgs & args = {} )

◆ note_run_failure() [3/4]

void pineforge::note_run_failure ( BacktestEngine & engine,
std::string text,
const RunFailureValue & value )

◆ note_run_failure() [4/4]

void pineforge::note_run_failure ( BacktestEngine & engine,
const char * entrypoint,
const std::exception & error )

◆ note_run_failure_unknown()

void pineforge::note_run_failure_unknown ( BacktestEngine & engine,
const char * entrypoint )

◆ clear_run_failure()

◆ run_failure_code_of()

const char * pineforge::run_failure_code_of ( const BacktestEngine & engine)
noexcept

The getters' answers (strategy_get_last_error_code / _args): the stored code while its text is the engine's last error; engine_unclassified_error for a non-empty error no coded site wrote; "" when there is no failure.

◆ run_failure_args_of()

const char * pineforge::run_failure_args_of ( const BacktestEngine & engine)
noexcept

◆ run_failure_value_of()

RunFailureValue pineforge::run_failure_value_of ( const BacktestEngine & engine)
noexcept

The recorded value under the same rule (none when there is no failure).

Referenced by pineforge::source::PineStrategyHost::prepare_native_begin().

◆ pine_no_data_stop()

void pineforge::pine_no_data_stop ( const char * function,
const char * call,
std::int32_t line,
const char * english )
inline

Definition at line 315 of file run_failure.hpp.

References line, and no_data_request.

◆ pine_other_symbol_stop()

void pineforge::pine_other_symbol_stop ( const char * function,
const char * symbol_literal_or_null,
const char * call,
std::int32_t line,
const char * english )
inline

Definition at line 322 of file run_failure.hpp.

References line, and other_symbol_request.

◆ pine_array_stop()

void pineforge::pine_array_stop ( const char * reason,
const char * method_or_null,
const char * english )
inline

Definition at line 332 of file run_failure.hpp.

References pine_array_error.

◆ pine_collection_stop()

void pineforge::pine_collection_stop ( const char * collection,
const char * reason,
const char * english )
inline

Definition at line 340 of file run_failure.hpp.

References engine_invariant, pine_array_error, and pine_na_reference.

◆ pine_na_stop()

void pineforge::pine_na_stop ( const char * object,
const char * english )
inline

Definition at line 359 of file run_failure.hpp.

References pine_na_reference.

◆ pine_limit_stop()

void pineforge::pine_limit_stop ( const char * limit,
std::int64_t max,
const char * english )
inline

Definition at line 364 of file run_failure.hpp.

References pine_runtime_limit.

◆ pine_unsupported_stop()

void pineforge::pine_unsupported_stop ( const char * reason,
std::int32_t line,
const char * english )
inline

Definition at line 372 of file run_failure.hpp.

References line, and request_unsupported.

◆ pine_string_stop()

void pineforge::pine_string_stop ( const char * reason,
const char * english )
inline

Definition at line 380 of file run_failure.hpp.

References pine_string_error.

◆ pine_engine_invariant()

void pineforge::pine_engine_invariant ( const char * english)
inline

Definition at line 385 of file run_failure.hpp.

References engine_invariant.

◆ runtime_subdivision()

std::optional< RuntimeSubdivision > pineforge::runtime_subdivision ( const std::string & input_timeframe,
const std::string & requested_timeframe )

◆ runtime_subdivide()

std::vector< Bar > pineforge::runtime_subdivide ( const Bar & ,
RuntimeSubdivision  )

◆ swap()

void pineforge::swap ( ScriptString & a,
ScriptString & b )
inlinenoexcept

◆ operator+() [1/9]

ScriptString pineforge::operator+ ( ScriptString a,
const ScriptString & b )
inline

Definition at line 148 of file script_string.hpp.

References pineforge::ScriptString::append().

◆ operator+() [2/9]

ScriptString pineforge::operator+ ( ScriptString a,
std::string_view b )
inline

Definition at line 149 of file script_string.hpp.

References pineforge::ScriptString::append().

◆ operator+() [3/9]

ScriptString pineforge::operator+ ( ScriptString a,
const char * b )
inline

Definition at line 150 of file script_string.hpp.

References pineforge::ScriptString::append().

◆ operator+() [4/9]

ScriptString pineforge::operator+ ( ScriptString a,
const std::string & b )
inline

Definition at line 151 of file script_string.hpp.

References pineforge::ScriptString::append().

◆ operator+() [5/9]

ScriptString pineforge::operator+ ( ScriptString a,
char b )
inline

Definition at line 152 of file script_string.hpp.

◆ operator+() [6/9]

ScriptString pineforge::operator+ ( std::string_view a,
const ScriptString & b )
inline

◆ operator+() [7/9]

ScriptString pineforge::operator+ ( const std::string & a,
const ScriptString & b )
inline

Definition at line 159 of file script_string.hpp.

◆ operator+() [8/9]

ScriptString pineforge::operator+ ( const char * a,
const ScriptString & b )
inline

Definition at line 162 of file script_string.hpp.

◆ operator+() [9/9]

ScriptString pineforge::operator+ ( char a,
const ScriptString & b )
inline

Definition at line 165 of file script_string.hpp.

◆ operator==() [1/7]

bool pineforge::operator== ( const ScriptString & a,
const ScriptString & b )
inline

Definition at line 168 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator!=() [1/7]

bool pineforge::operator!= ( const ScriptString & a,
const ScriptString & b )
inline

Definition at line 169 of file script_string.hpp.

◆ operator<() [1/3]

bool pineforge::operator< ( const ScriptString & a,
const ScriptString & b )
inline

Definition at line 170 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator>() [1/3]

bool pineforge::operator> ( const ScriptString & a,
const ScriptString & b )
inline

Definition at line 171 of file script_string.hpp.

◆ operator<=() [1/3]

bool pineforge::operator<= ( const ScriptString & a,
const ScriptString & b )
inline

Definition at line 172 of file script_string.hpp.

◆ operator>=() [1/3]

bool pineforge::operator>= ( const ScriptString & a,
const ScriptString & b )
inline

Definition at line 173 of file script_string.hpp.

◆ operator==() [2/7]

bool pineforge::operator== ( const ScriptString & a,
std::string_view b )
inline

Definition at line 174 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator==() [3/7]

bool pineforge::operator== ( std::string_view a,
const ScriptString & b )
inline

Definition at line 175 of file script_string.hpp.

◆ operator!=() [2/7]

bool pineforge::operator!= ( const ScriptString & a,
std::string_view b )
inline

Definition at line 176 of file script_string.hpp.

◆ operator!=() [3/7]

bool pineforge::operator!= ( std::string_view a,
const ScriptString & b )
inline

Definition at line 177 of file script_string.hpp.

◆ operator==() [4/7]

bool pineforge::operator== ( const ScriptString & a,
const char * b )
inline

Definition at line 178 of file script_string.hpp.

◆ operator==() [5/7]

bool pineforge::operator== ( const char * a,
const ScriptString & b )
inline

Definition at line 179 of file script_string.hpp.

◆ operator!=() [4/7]

bool pineforge::operator!= ( const ScriptString & a,
const char * b )
inline

Definition at line 180 of file script_string.hpp.

◆ operator!=() [5/7]

bool pineforge::operator!= ( const char * a,
const ScriptString & b )
inline

Definition at line 181 of file script_string.hpp.

◆ operator==() [6/7]

bool pineforge::operator== ( const ScriptString & a,
const std::string & b )
inline

Definition at line 182 of file script_string.hpp.

◆ operator==() [7/7]

bool pineforge::operator== ( const std::string & a,
const ScriptString & b )
inline

Definition at line 183 of file script_string.hpp.

◆ operator!=() [6/7]

bool pineforge::operator!= ( const ScriptString & a,
const std::string & b )
inline

Definition at line 184 of file script_string.hpp.

◆ operator!=() [7/7]

bool pineforge::operator!= ( const std::string & a,
const ScriptString & b )
inline

Definition at line 185 of file script_string.hpp.

◆ operator<() [2/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator< ( const ScriptString & a,
const Text & b )
inline

Definition at line 190 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator<() [3/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator< ( const Text & a,
const ScriptString & b )
inline

Definition at line 192 of file script_string.hpp.

◆ operator>() [2/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator> ( const ScriptString & a,
const Text & b )
inline

Definition at line 194 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator>() [3/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator> ( const Text & a,
const ScriptString & b )
inline

Definition at line 196 of file script_string.hpp.

◆ operator<=() [2/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator<= ( const ScriptString & a,
const Text & b )
inline

Definition at line 198 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator<=() [3/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator<= ( const Text & a,
const ScriptString & b )
inline

Definition at line 200 of file script_string.hpp.

◆ operator>=() [2/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator>= ( const ScriptString & a,
const Text & b )
inline

Definition at line 202 of file script_string.hpp.

References pineforge::ScriptString::compare().

◆ operator>=() [3/3]

template<class Text, std::enable_if_t< std::is_convertible_v< const Text &, std::string_view >, int > = 0>
bool pineforge::operator>= ( const Text & a,
const ScriptString & b )
inline

Definition at line 204 of file script_string.hpp.

◆ str_tonumber()

double pineforge::str_tonumber ( const ScriptString & )

◆ window_cache_capacity()

◆ normalize_timezone_for_posix()

std::string pineforge::normalize_timezone_for_posix ( const std::string & tz)

◆ timeframe_time() [1/2]

int64_t pineforge::timeframe_time ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & syminfo_tz = std::string() )

Referenced by pine_time(), and pine_time().

◆ timeframe_time_close() [1/2]

int64_t pineforge::timeframe_time_close ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & syminfo_tz = std::string() )

Referenced by pine_time_close(), and pine_time_close().

◆ timeframe_time() [2/2]

int64_t pineforge::timeframe_time ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & sym_tz,
const std::string & sym_session )

◆ timeframe_time_close() [2/2]

int64_t pineforge::timeframe_time_close ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & sym_tz,
const std::string & sym_session )

◆ hhmm_to_minutes()

int pineforge::hhmm_to_minutes ( const std::string & hhmm)

◆ local_hour()

int pineforge::local_hour ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_hour().

◆ local_minute()

int pineforge::local_minute ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_minute().

◆ local_second()

int pineforge::local_second ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_second().

◆ local_dayofmonth()

int pineforge::local_dayofmonth ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_dayofmonth().

◆ local_dayofweek()

int pineforge::local_dayofweek ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_dayofweek().

◆ local_month()

int pineforge::local_month ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_month().

◆ local_year()

int pineforge::local_year ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_year().

◆ local_weekofyear()

int pineforge::local_weekofyear ( int64_t bar_ms,
const std::string & tz )

Referenced by pine_weekofyear().

◆ local_time_in_session_windows()

bool pineforge::local_time_in_session_windows ( const std::string & windows_body,
const struct tm & local_tm )

◆ session_trades_at()

bool pineforge::session_trades_at ( const std::string & session,
const std::string & tz,
int64_t bar_ms )

◆ passes_session_filter()

bool pineforge::passes_session_filter ( const std::string & session,
const std::string & tz,
int64_t bar_ms )

◆ calendar_day_open_local_ms()

int64_t pineforge::calendar_day_open_local_ms ( int64_t bar_ms,
const std::string & tz )

◆ session_trading_day_open_ms()

int64_t pineforge::session_trading_day_open_ms ( int64_t bar_ms,
const std::string & session,
const std::string & tz )

Referenced by pine_time_tradingday().

◆ session_in_market() [1/2]

bool pineforge::session_in_market ( const std::string & session,
const std::string & tz,
int64_t bar_ms )

◆ session_in_premarket() [1/2]

bool pineforge::session_in_premarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms )

◆ session_in_postmarket() [1/2]

bool pineforge::session_in_postmarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms )

◆ session_in_market() [2/2]

bool pineforge::session_in_market ( const std::string & session,
const std::string & tz,
int64_t bar_ms,
const std::string & chart_tf )

◆ session_in_premarket() [2/2]

bool pineforge::session_in_premarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms,
const std::string & chart_tf )

◆ session_in_postmarket() [2/2]

bool pineforge::session_in_postmarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms,
const std::string & chart_tf )

◆ pine_time() [1/2]

int64_t pineforge::pine_time ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & syminfo_tz = std::string() )
inline

Definition at line 221 of file session_time.hpp.

References timeframe_time().

Referenced by pineforge::source::PineStrategyHost::pine_time_offset().

◆ pine_time() [2/2]

int64_t pineforge::pine_time ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & sym_tz,
const std::string & sym_session )
inline

Definition at line 228 of file session_time.hpp.

References timeframe_time().

◆ pine_time_close() [1/2]

int64_t pineforge::pine_time_close ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & syminfo_tz = std::string() )
inline

◆ pine_time_close() [2/2]

int64_t pineforge::pine_time_close ( int64_t bar_ms,
const std::string & tf,
const std::string & session,
const std::string & tz,
const std::string & chart_tf,
const std::string & sym_tz,
const std::string & sym_session )
inline

Definition at line 242 of file session_time.hpp.

References timeframe_time_close().

◆ pine_hour()

int pineforge::pine_hour ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 249 of file session_time.hpp.

References local_hour().

◆ pine_minute()

int pineforge::pine_minute ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 250 of file session_time.hpp.

References local_minute().

◆ pine_second()

int pineforge::pine_second ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 251 of file session_time.hpp.

References local_second().

◆ pine_dayofmonth()

int pineforge::pine_dayofmonth ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 252 of file session_time.hpp.

References local_dayofmonth().

◆ pine_dayofweek()

int pineforge::pine_dayofweek ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 253 of file session_time.hpp.

References local_dayofweek().

◆ pine_month()

int pineforge::pine_month ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 254 of file session_time.hpp.

References local_month().

◆ pine_year()

int pineforge::pine_year ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 255 of file session_time.hpp.

References local_year().

◆ pine_weekofyear()

int pineforge::pine_weekofyear ( int64_t bar_ms,
const std::string & tz )
inline

Definition at line 256 of file session_time.hpp.

References local_weekofyear().

◆ pine_time_tradingday()

int64_t pineforge::pine_time_tradingday ( int64_t bar_ms,
const std::string & session,
const std::string & tz )
inline

Definition at line 258 of file session_time.hpp.

References session_trading_day_open_ms().

◆ pine_session_ismarket() [1/2]

bool pineforge::pine_session_ismarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms )
inline

◆ pine_session_ispremarket() [1/2]

bool pineforge::pine_session_ispremarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms )
inline

◆ pine_session_ispostmarket() [1/2]

bool pineforge::pine_session_ispostmarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms )
inline

◆ pine_session_ismarket() [2/2]

bool pineforge::pine_session_ismarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms,
const std::string & chart_tf )
inline

Definition at line 278 of file session_time.hpp.

References session_in_market().

◆ pine_session_ispremarket() [2/2]

bool pineforge::pine_session_ispremarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms,
const std::string & chart_tf )
inline

Definition at line 283 of file session_time.hpp.

References session_in_premarket().

◆ pine_session_ispostmarket() [2/2]

bool pineforge::pine_session_ispostmarket ( const std::string & session,
const std::string & tz,
int64_t bar_ms,
const std::string & chart_tf )
inline

Definition at line 288 of file session_time.hpp.

References session_in_postmarket().

◆ pine_float_eq()

bool pineforge::pine_float_eq ( double a,
double b )
inline

Definition at line 19 of file pine_float_compare.hpp.

References float_band_eq().

◆ pine_float_ne()

bool pineforge::pine_float_ne ( double a,
double b )
inline

Definition at line 20 of file pine_float_compare.hpp.

References float_band_ne().

◆ pine_float_gt()

bool pineforge::pine_float_gt ( double a,
double b )
inline

Definition at line 21 of file pine_float_compare.hpp.

References float_band_gt().

◆ pine_float_lt()

bool pineforge::pine_float_lt ( double a,
double b )
inline

Definition at line 22 of file pine_float_compare.hpp.

References float_band_lt().

◆ pine_float_ge()

bool pineforge::pine_float_ge ( double a,
double b )
inline

Definition at line 23 of file pine_float_compare.hpp.

References float_band_ge().

◆ pine_float_le()

bool pineforge::pine_float_le ( double a,
double b )
inline

Definition at line 24 of file pine_float_compare.hpp.

References float_band_le().

◆ str_format_values() [1/2]

std::string pineforge::str_format_values ( const std::string & fmt,
const std::vector< StrFormatValue > & args )

◆ str_format() [1/2]

std::string pineforge::str_format ( const std::string & fmt,
const std::vector< std::string > & args )

Referenced by pine_str_format().

◆ str_format_time()

std::string pineforge::str_format_time ( long long timestamp_ms,
const std::string & format,
const std::string & timezone )

Referenced by pine_str_format_time().

◆ str_match()

std::string pineforge::str_match ( const std::string & source,
const std::string & regex_pattern )

Referenced by pine_str_match().

◆ str_split() [1/5]

std::vector< std::string > pineforge::str_split ( const std::string & source,
const std::string & separator )

◆ str_tostring() [1/2]

std::string pineforge::str_tostring ( double value,
const std::string & format_mode = "",
double mintick = 0.0 )

Referenced by pine_str_tostring().

◆ script_str_format_values()

ScriptString pineforge::script_str_format_values ( const ScriptString & ,
const std::vector< ScriptStrFormatValue > &  )

Referenced by str_format_values().

◆ script_str_format()

ScriptString pineforge::script_str_format ( const ScriptString & ,
const std::vector< ScriptString > &  )

Referenced by pine_str_format(), and str_format().

◆ str_tostring() [2/2]

ScriptString pineforge::str_tostring ( detail::o1::Store & ,
double value,
const ScriptString & format_mode = {},
double mintick = 0.0 )

◆ str_format_values() [2/2]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptString pineforge::str_format_values ( Text && format,
const std::vector< ScriptStrFormatValue > & args )
inline

Definition at line 111 of file str_utils.hpp.

References script_str_format_values().

◆ str_format() [2/2]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptString pineforge::str_format ( Text && format,
const std::vector< ScriptString > & args )
inline

Definition at line 115 of file str_utils.hpp.

References script_str_format().

◆ str_split() [2/5]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts pineforge::str_split ( Text && source,
const ScriptString & separator )
inline

Definition at line 119 of file str_utils.hpp.

◆ str_split() [3/5]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts pineforge::str_split ( Text && source,
std::string_view separator )
inline

Definition at line 123 of file str_utils.hpp.

References pineforge::ScriptStringScope::current().

◆ str_split() [4/5]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts pineforge::str_split ( Text && source,
const char * separator )
inline

Definition at line 128 of file str_utils.hpp.

References str_split().

◆ str_split() [5/5]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts pineforge::str_split ( Text && source,
const std::string & separator )
inline

Definition at line 132 of file str_utils.hpp.

References str_split().

◆ pine_str_format() [1/2]

std::string pineforge::pine_str_format ( const std::string & fmt,
const std::vector< std::string > & args )
inline

Definition at line 139 of file str_utils.hpp.

References str_format().

◆ pine_str_format_time()

std::string pineforge::pine_str_format_time ( long long timestamp_ms,
const std::string & format,
const std::string & timezone )
inline

Definition at line 144 of file str_utils.hpp.

References str_format_time().

◆ pine_str_match()

std::string pineforge::pine_str_match ( const std::string & source,
const std::string & regex_pattern )
inline

Definition at line 150 of file str_utils.hpp.

References str_match().

◆ pine_str_split() [1/2]

std::vector< std::string > pineforge::pine_str_split ( const std::string & source,
const std::string & separator )
inline

Definition at line 155 of file str_utils.hpp.

References str_split().

◆ pine_str_tostring() [1/2]

std::string pineforge::pine_str_tostring ( double value,
const std::string & format_mode = "",
double mintick = 0.0 )
inline

Definition at line 160 of file str_utils.hpp.

References str_tostring().

◆ pine_str_format() [2/2]

template<class Text, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptString pineforge::pine_str_format ( Text && format,
const std::vector< ScriptString > & args )
inline

Definition at line 167 of file str_utils.hpp.

References script_str_format().

◆ pine_str_split() [2/2]

template<class Text, class Separator, std::enable_if_t< std::is_same_v< std::decay_t< Text >, ScriptString >, int > = 0>
ScriptStringParts pineforge::pine_str_split ( Text && source,
Separator && separator )
inline

Definition at line 172 of file str_utils.hpp.

References str_split().

◆ pine_str_tostring() [2/2]

ScriptString pineforge::pine_str_tostring ( detail::o1::Store & store,
double value,
const ScriptString & format = {},
double mintick = 0.0 )
inline

Definition at line 175 of file str_utils.hpp.

◆ float_band_eq()

bool pineforge::float_band_eq ( double a,
double b )
inline

◆ float_band_ne()

bool pineforge::float_band_ne ( double a,
double b )
inline

Definition at line 45 of file ta_compare_band.hpp.

References float_band_eq().

Referenced by pine_float_ne().

◆ float_band_gt()

bool pineforge::float_band_gt ( double a,
double b )
inline

Definition at line 50 of file ta_compare_band.hpp.

References float_band_eq().

Referenced by pine_float_gt().

◆ float_band_lt()

bool pineforge::float_band_lt ( double a,
double b )
inline

Definition at line 55 of file ta_compare_band.hpp.

References float_band_eq().

Referenced by pine_float_lt().

◆ float_band_ge()

bool pineforge::float_band_ge ( double a,
double b )
inline

Definition at line 60 of file ta_compare_band.hpp.

References float_band_eq().

Referenced by pine_float_ge().

◆ float_band_le()

bool pineforge::float_band_le ( double a,
double b )
inline

Definition at line 65 of file ta_compare_band.hpp.

References float_band_eq().

Referenced by pine_float_le().

◆ tf_to_seconds()

int pineforge::tf_to_seconds ( const std::string & tf)

Convert a TradingView timeframe string to seconds.

Minute-based: "1","5","15","30","60","120","240" => minutes * 60 Day-based: "D","1D" => 86400 Week-based: "W","1W" => 604800 Month-based: "M","1M" => -1 (calendar-based, not fixed seconds)

Referenced by pineforge::source::PineScheduler::bar(), pineforge::source::PineStrategyHost::make_runtime_security_cursor(), pineforge::source::PineStrategyHost::pine_time_offset(), safe_tf_to_seconds(), pineforge::source::PineStrategyHost::set_aux_security_feed(), tf_is_daily(), tf_is_intraday(), and pineforge::source::PineStrategyHost::validate_security_timeframes().

◆ tf_multiplier()

int pineforge::tf_multiplier ( const std::string & tf)
inline

Extract the numeric multiplier from a TF string (e.g. "15" -> 15, "D" -> 1).

Definition at line 33 of file timeframe.hpp.

◆ tf_is_intraday()

bool pineforge::tf_is_intraday ( const std::string & tf)
inline

Definition at line 42 of file timeframe.hpp.

References kSecPerDay, and tf_to_seconds().

◆ tf_is_daily()

bool pineforge::tf_is_daily ( const std::string & tf)
inline

Definition at line 47 of file timeframe.hpp.

References kSecPerDay, and tf_to_seconds().

◆ tf_is_weekly()

bool pineforge::tf_is_weekly ( const std::string & tf)
inline

Definition at line 51 of file timeframe.hpp.

◆ tf_is_monthly()

bool pineforge::tf_is_monthly ( const std::string & tf)
inline

Definition at line 55 of file timeframe.hpp.

◆ tf_is_seconds()

bool pineforge::tf_is_seconds ( const std::string & tf)
inline

Definition at line 59 of file timeframe.hpp.

◆ tf_change() [1/2]

bool pineforge::tf_change ( int64_t prev_ms,
int64_t curr_ms,
const std::string & tf )

Check if prev/curr timestamps cross a timeframe boundary.

Referenced by pineforge::source::PineRuntimeSecurityCursor::feed(), and pineforge::source::PineScheduler::input().

◆ tf_ratio()

int pineforge::tf_ratio ( const std::string & input_tf,
const std::string & target_tf )

Compute how many input bars fit into one target bar.

Returns positive int for ratio-based, -1 for calendar-based (month), -2 if target < input (error).

Referenced by pineforge::source::PineStrategyHost::prepare_native_begin(), pineforge::source::PineExecutionAdapter::project(), and pineforge::source::PineScheduler::run_begin().

◆ detect_timeframe()

std::string pineforge::detect_timeframe ( const Bar * bars,
int n,
int max_samples = 100 )

Detect the timeframe string from an array of bars by computing the median timestamp delta and mapping to the nearest standard TF.

Returns a TradingView-style TF string (e.g. "1", "5", "15", "60", "D", "W"). Uses up to the first max_samples bars for detection. Returns "1" if detection fails (< 2 bars or irregular data).

Referenced by pineforge::source::PineStrategyHost::prepare_native_begin(), and pineforge::source::PineExecutionAdapter::project().

◆ calendar_period_for()

◆ tf_is_daily_or_higher()

bool pineforge::tf_is_daily_or_higher ( const std::string & tf)
inline

True for a daily-or-higher chart timeframe ("D", "1D", "2D", "W", "M"): a bar that covers whole session days rather than a time of day (the aggregation path's CALENDAR classification).

Intraday timeframes and an empty (undetected) one are false.

Definition at line 90 of file timeframe.hpp.

References calendar_period_for(), and NONE.

◆ crosses_boundary() [1/2]

bool pineforge::crosses_boundary ( int64_t prev_ms,
int64_t curr_ms,
CalendarPeriod period )

Check if two timestamps (Unix milliseconds) fall in different calendar periods.

◆ crosses_boundary() [2/2]

bool pineforge::crosses_boundary ( int64_t prev_ms,
int64_t curr_ms,
CalendarPeriod period,
const std::string & tz,
const std::string & session )

Timezone/session-aware variants.

The tz-less forms above evaluate the calendar in UTC and intraday buckets from each UTC midnight. Session symbols (equities RTH, forex) anchor HTF buckets on the exchange clock instead: daily boundaries at symbol-local midnight, intraday buckets offset by the symbol's day stamp – the session open, except OANDA's 1800-1700 metals session whose day (and TradingView's "45"/"240" grid) rolls at the 17:00 ET forex roll one hour before it opens (session_day_stamp_offset_minutes in timeframe.cpp cites the pin). With tz="UTC" and session ""/"24x7" these use the same UTC daily grid as the tz-less forms.

◆ tf_change() [2/2]

bool pineforge::tf_change ( int64_t prev_ms,
int64_t curr_ms,
const std::string & tf,
const std::string & tz,
const std::string & session )

◆ session_day_index()

int64_t pineforge::session_day_index ( int64_t ms,
const std::string & tz,
const std::string & session )

Ordinal of the session day containing ms (days since epoch on the session clock).

UTC + no session: ms / kMsPerDay.

◆ session_period_open_ms()

int64_t pineforge::session_period_open_ms ( int64_t ms,
const std::string & tz,
const std::string & session,
CalendarPeriod period )

Open (Unix ms) of the symbol's D/W/M bar that contains ms: the day stamp of the period's first session-day (17:00 ET on OANDA 1800-1700, the session open elsewhere).

CalendarPeriod::NONE returns ms unchanged.

Referenced by pineforge::source::PineScheduler::bar(), pineforge::source::multi_day_detail::FeedWalk::next(), pineforge::source::multi_day_detail::RescannedStamps::next(), and pineforge::source::multi_day_detail::Stamps::next().

◆ session_intraday_bucket_open_ms()

int64_t pineforge::session_intraday_bucket_open_ms ( int64_t ms,
int64_t bucket_sec,
const std::string & tz,
const std::string & session )

Open (Unix ms) of the bucket_sec-wide intraday bucket that contains ms on the symbol's day-stamp-anchored grid: time WITHIN the session day, floored to the bucket width.

This is THE intraday HTF grid — request.security's ratio buckets (TimeframeAggregator::bucket_open_ms), tf_change and time("<intraday tf>") / time_close all read it (pin-time-hours: time("60") on NYSE:F is 09:30 / 10:30 / .. / 15:30 ET, time("240") on NSE:NIFTY 09:15 / 13:15 IST, on OANDA:XAUUSD 17:00 ET + 4h*k). With tz="UTC" and session ""/"24x7" the declared origin is UTC midnight; widths dividing 24h also equal the continuous epoch grid. bucket_sec <= 0 returns ms. Under the calling thread's native daily partition for this clock (below), a session-day that opened late – NativeDayPartition::late_opens – starts its grid at its own open instead of the day stamp, as tf_change's intraday form does. Inputs before a declared late open fold into its first bucket. This stamp-only seam has no aggregate observation history: a prefix query uses ms as its point context and opens there; a post-open query opens at the declared origin. ms may itself be a grid label and is not asserted to be a raw first input. Aggregators retain their actual first input separately and supply it to the shared writer for a stable prefix label. Neither a grid label nor first printed data defines a session origin. Legacy per-UTC-day timezone offsets remain in force; session-less DST transition edges can share a key with differing bounds across queries, and remain unmeasured against TradingView.

◆ session_intraday_bucket_end_ms()

int64_t pineforge::session_intraday_bucket_end_ms ( int64_t ms,
int64_t bucket_sec,
const std::string & tz,
const std::string & session )

Exclusive end from the SAME intraday boundary writer as the open seam.

Normal end = origin + (ordinal + 1) * width, capped at the session-day close (next midnight for 24x7). A late-open prefix shares the first bucket's origin + width end; this needs no observation history. bucket_sec <= 0 returns ms.

◆ session_covered_instant_ms()

int64_t pineforge::session_covered_instant_ms ( int64_t ms,
const std::string & tz,
const std::string & session )

The session instant a native CALENDAR chart stamp covers.

A stamp inside its session (open to exclusive close) returns unchanged. A stamp in the inter-session gap – before its session-day's open (the 1800-1700 day stamp hour) or at / after its close – covers the session about to open – OANDA stamps daily FX/metal bars at the 17:00 ET break under an 1800-1700 session – and rolls forward to that session's open. ""/24x7 sessions have no gap and always return ms unchanged.

Referenced by pineforge::source::multi_day_detail::FeedWalk::next().

◆ session_period_close_ms()

int64_t pineforge::session_period_close_ms ( int64_t ms,
const std::string & tz,
const std::string & session,
CalendarPeriod period )

Exclusive close (Unix ms) of the symbol's D/W/M bar that contains ms: DAY -> session-day open + session length (16:00 ET on equities, the next 17:00 ET on forex, next midnight on 24x7); WEEK / MONTH -> the open of the next period's first session-day.

CalendarPeriod::NONE returns ms.

◆ session_period_last_traded_close_ms()

int64_t pineforge::session_period_last_traded_close_ms ( int64_t ms,
const std::string & tz,
const std::string & session,
CalendarPeriod period )

Exclusive close (Unix ms) of the LAST TRADED session-day of the D/W/M bar that contains ms: DAY is session_period_close_ms; WEEK / MONTH step back from the period's last session-day over weekend TRADING dates (Saturday / Sunday never hold a session on exchange-calendar symbols), so an equity week ends Friday 16:00 ET, a month whose last calendar day is a weekend ends on its last Friday, and the forex week ends Friday 17:00 ET (the Friday-open session is Saturday's trading date).

Exchange holidays are not modelled. CalendarPeriod::NONE returns ms.

◆ native_late_day_opens()

std::vector< int64_t > pineforge::native_late_day_opens ( const std::string & tz,
const std::string & session,
const std::vector< int64_t > & stamps,
const Bar * input_bars,
int n_input )

The native daily stamps that open their session-day LATE: a stamp after the day stamp of the (nominal) session-day holding it and before that day's scheduled close, with no input bar between the day stamp and the stamp – the day's first trade is the stamp itself, hours after the session template's open (NSE's Muhurat session of 2025-10-21, 13:45 IST).

Every other stamp is left out: one at its day stamp (every regular day), one on an earlier session-day (a holiday-merged bar), one at or after its session-day's scheduled close (a venue dating its daily bars at midnight or at the close; an evening session the template does not hold, 18:00 IST on 2024-11-01, whose end it cannot know either), and one the input shows the day already trading before. Strictly increasing, as the stamps; empty for non-increasing stamps. input_bars may be null (n_input 0): nothing then contradicts a late stamp.

◆ build_native_day_partition() [1/2]

bool pineforge::build_native_day_partition ( NativeDayPartition & out,
const std::string & tz,
const std::string & session,
const std::vector< int64_t > & stamps,
const Bar * input_bars,
int n_input,
const std::string & scratch_directory = {} )

Build the partition for the symbol clock (tz, session) from the native daily stamps and the chart's input bars (the trade instants: the last input bar before the next stamp, bounded by the last stamp's nominal session-day close; the stamp itself when no input bar lies in the period).

Returns false – and leaves out empty – for no stamps or non-increasing stamps.

◆ build_native_day_partition() [2/2]

bool pineforge::build_native_day_partition ( NativeDayPartition & out,
const std::string & tz,
const std::string & session,
const std::vector< int64_t > & stamps,
const Bar * input_bars,
int n_input,
std::size_t projection_cache_bytes,
const std::string & scratch_directory = {} )

As above, with an inclusive optional cache budget for EACH of the three projection columns.

Zero/sub-page budgets read directly from backing. Stamps, late opens and caller input bars retain their existing ownership.

◆ native_day_partition_index()

int pineforge::native_day_partition_index ( const NativeDayPartition & p,
int64_t ms )

Index of the native period holding ms under p: -1 before the first stamp and at / after the last stamp's nominal session-day close.

◆ set_active_native_day_partition()

const NativeDayPartition * pineforge::set_active_native_day_partition ( const NativeDayPartition * p)

The calling thread's active chart partition, read by session_day_index / session_period_open_ms / session_period_close_ms / session_period_last_traded_close_ms / crosses_boundary (and so by tf_change, the symbol-clock pine_time forms and ta::VWAP's session anchor) whenever their (tz, session) equal the partition's.

nullptr (the default) leaves every rule nominal. set_ returns the previous pointer; BacktestEngine::run installs its chart partition through NativeDayPartitionScope for exactly the run's bar loop.

Referenced by pineforge::NativeDayPartitionScope::NativeDayPartitionScope(), and pineforge::NativeDayPartitionScope::~NativeDayPartitionScope().

◆ active_native_day_partition()

const NativeDayPartition * pineforge::active_native_day_partition ( )

◆ safe_tf_to_seconds()

static int pineforge::safe_tf_to_seconds ( const std::string & tf)
static

Definition at line 197 of file pine_security_eval.cpp.

References tf_to_seconds().

◆ same_bar_exit_group_possible()

Variable Documentation

◆ is_pine_map_snapshot_value_v

template<typename T>
bool pineforge::is_pine_map_snapshot_value_v
inlineconstexpr
Initial value:

Definition at line 585 of file map.hpp.

◆ kRunFailureCodeCount

std::uint16_t pineforge::kRunFailureCodeCount = 88
inlineconstexpr

Definition at line 105 of file run_failure_codes.hpp.

◆ kPineFloatEqualityBand

double pineforge::kPineFloatEqualityBand = kFloatCompareBand
inlineconstexpr

Definition at line 17 of file pine_float_compare.hpp.

◆ kFloatCompareBand

double pineforge::kFloatCompareBand = 1e-10
inlineconstexpr

Definition at line 36 of file ta_compare_band.hpp.

Referenced by float_band_eq().

◆ kSecPerDay

int64_t pineforge::kSecPerDay = 86400
inlineconstexpr

Definition at line 13 of file timeframe.hpp.

Referenced by tf_is_daily(), and tf_is_intraday().

◆ kMsPerDay

int64_t pineforge::kMsPerDay = 86400000
inlineconstexpr

Definition at line 14 of file timeframe.hpp.