739 void set_begin_mode(
bool is_stream,
bool bar_magnifier =
false) noexcept;
747 double limit_price =
std::numeric_limits<
double>::quiet_NaN(),
748 double stop_price =
std::numeric_limits<
double>::quiet_NaN(),
749 double qty =
std::numeric_limits<
double>::quiet_NaN(),
750 const
std::
string& comment = {},
const std::string& oca_name = {},
751 int oca_type = 0,
int qty_type = -1);
752 void close(
const SourceId&
id,
const std::string& comment = {},
753 double qty = std::numeric_limits<double>::quiet_NaN(),
754 double qty_percent = std::numeric_limits<double>::quiet_NaN(),
755 bool immediately =
false, std::uint64_t callsite_token = 0);
758 double limit_price,
double stop_price,
759 double trail_points = std::numeric_limits<double>::quiet_NaN(),
760 double trail_offset = std::numeric_limits<double>::quiet_NaN(),
761 double trail_price = std::numeric_limits<double>::quiet_NaN(),
762 double qty_percent = 100.0,
const std::string& comment = {},
763 double qty = std::numeric_limits<double>::quiet_NaN(),
764 const std::string& oca_name = {},
765 double profit_ticks = std::numeric_limits<double>::quiet_NaN(),
766 double loss_ticks = std::numeric_limits<double>::quiet_NaN());
768 const std::string& comment = {});
772 double limit_price = std::numeric_limits<double>::quiet_NaN(),
773 double stop_price = std::numeric_limits<double>::quiet_NaN(),
774 const std::string& oca_name = {},
int oca_type = 0);
776 native_order::ExecutionTerms
resolve_terms(
const NativeExecutionTermsFacts&)
const;
796 return anchored_relative_stats_;
827 std::int64_t sub_bar_open_ms)
const;
848 double held_units) const;
872 return cohort_exposure_for(
id);
885 return close_logical_units_.size();
891 return close_batch_pending_debt_;
894 return close_batch_admitted_total_;
904 return risk_.direction == 0 || (is_long ? risk_.direction > 0 : risk_.direction < 0);
908 return risk_.max_intraday_loss_percent;
923 return market_pyramid_adds_.count(incarnation) != 0;
933 return coof_recalc_active_ && coof_context_.coordinate.path_phase == NativePathPhase::Close;
938 named_entry_cancel_tokens_.clear();
939 pending_same_bar_close_qty_ = 0.0;
940 source_batch_mutated_ =
false;
943 return named_entry_cancel_tokens_.find(
id) != named_entry_cancel_tokens_.end();
955 bool post_calculation =
true,
956 bool pre_script_drain =
false);
963 bool explicit_brackets_only =
false,
964 double current_open = std::numeric_limits<double>::quiet_NaN());
967 std::uint64_t source_fill_sequence);
974 const
SourceId& from_entry = {})
const noexcept;
994 std::vector<native_order::RequestHandle> opened;
1000 std::unordered_map<std::uint64_t, double> live_units_by_origin;
1001 std::int64_t cycle = 0;
1004 struct PendingBracketLeg {
1008 std::uint64_t family_key = 0;
1011 struct PendingEntry {
1012 native_order::Request request;
1013 PlacementSnapshot snapshot;
1017 struct DelayedMarketOrder {
1018 native_order::Request request;
1019 PlacementSnapshot snapshot;
1021 std::uint64_t release_open_epoch = 0;
1022 bool execute_at_open =
false;
1030 struct DeferredOpenMarketableSell {
1031 PlacementSnapshot snapshot;
1033 double fill_price = std::numeric_limits<double>::quiet_NaN();
1034 double path_position = 0.0;
1035 bool open_marketable =
false;
1043 struct PendingSameBarCommand {
1044 native_order::Request request;
1045 PlacementSnapshot snapshot;
1047 bool opening =
false;
1054 struct SourceShadowPending {
1055 PlacementSnapshot snapshot;
1059 struct PendingRelativeExit {
1062 double trail_points = std::numeric_limits<double>::quiet_NaN();
1063 double trail_offset = std::numeric_limits<double>::quiet_NaN();
1064 double trail_price = std::numeric_limits<double>::quiet_NaN();
1065 double qty_percent = 100.0;
1066 std::string comment;
1067 double qty = std::numeric_limits<double>::quiet_NaN();
1068 std::string oca_name;
1069 double profit_ticks = std::numeric_limits<double>::quiet_NaN();
1070 double loss_ticks = std::numeric_limits<double>::quiet_NaN();
1084 struct AnchoredRelativeLeg {
1088 native_order::RequestHandle handle{};
1089 native_order::RequestHandle parent{};
1090 bool parent_long =
true;
1093 double operand_ticks = 0.0;
1094 double trail_offset = std::numeric_limits<double>::quiet_NaN();
1095 native_order::Request request;
1097 double installed_level = std::numeric_limits<double>::quiet_NaN();
1100 struct PendingCoofRequest {
1101 native_order::Request request;
1102 PlacementSnapshot snapshot;
1104 bool opening =
false;
1105 std::uint64_t family_key = 0;
1106 bool next_open =
false;
1109 struct PendingMarginRevival {
1110 PlacementSnapshot snapshot;
1111 std::int32_t decline_bar = -1;
1114 struct NamedEntryCancelToken {
1115 std::uint64_t entry_incarnation = 0;
1116 std::uint64_t surviving_exit_incarnation = 0;
1119 struct CloseCallsiteState {
1120 bool active =
false;
1121 std::uint64_t token = 0;
1124 double first_target = 0.0;
1125 bool first_ledger_consumed =
false;
1126 bool first_carry_valid =
false;
1127 double first_carry_qty = 0.0;
1129 std::string comment{};
1130 double target = 0.0;
1131 bool retire_ledger_whole =
false;
1132 std::uint64_t queue_sequence = 0;
1133 std::vector<SourceId> deferred_cleanup_ids;
1136 NativeStrategyHost& require_host()
const;
1137 native_order::CohortHandle cohort_for(
const SourceId&
id);
1138 std::optional<native_order::RequestHandle> submit_or_replace(
1139 native_order::Request request, PlacementSnapshot snapshot,
bool opening,
1140 const SourceId& replacement_key = {});
1141 void remember(
const native_order::RequestHandle&, PlacementSnapshot);
1142 void retire(native_order::RequestHandle)
noexcept;
1143 std::vector<native_order::RequestHandle> openings_for(
const SourceId&)
const;
1144 double cohort_exposure_for(
const SourceId&)
const noexcept;
1145 bool from_entry_filled_this_cycle(
const SourceId&)
const noexcept;
1146 double percent_commission_live_equity(
double)
const noexcept;
1147 double quantize_close_units(
double basis,
double percent)
const noexcept;
1148 double quantize_percent_exit_units(
double requested,
1149 double available)
const noexcept;
1150 bool compute_exit_reservation(
const SourceId& exit_id,
1152 double requested_qty,
1153 double& qty_percent,
1155 double& reserved_qty)
const;
1156 void reconcile_deferred_exit_reservations(
const SourceId& from_entry,
1158 double active_staged_fx(std::int64_t)
const noexcept;
1159 void apply_fx_open_margin_slice(
const Bar&,
const NativeDecisionContext&);
1160 void apply_fx_opening_margin_slice(
const native_order::ExecutionAppliedEvent&,
1161 const NativeDecisionContext&);
1162 void submit_fx_margin_slice(
const Bar&,
const NativeDecisionContext&,
double rate,
1163 bool execute_at_current);
1164 void schedule_preopen_margin_slice(
const Bar&,
const NativeDecisionContext&);
1165 bool submit_margin_call_slice(
double mark_price,
const NativeDecisionContext&,
1166 bool opening_checkpoint =
false);
1167 bool submit_margin_call_units(
double mark_price,
const NativeDecisionContext&,
1169 bool force_execution_price =
true);
1170 bool submit_tv_money_long_margin_call(
const Bar&,
const NativeDecisionContext&);
1171 bool slipped_pooc_opening_money_scope(
1172 const Bar&,
const NativeDecisionContext&)
const;
1173 bool submit_slipped_pooc_opening_money_call(
1174 const Bar&,
const NativeDecisionContext&);
1175 bool schedule_tv_money_long_margin_before_trail(
1176 const Bar&,
const NativeDecisionContext&);
1177 bool market_orders_pending_at_close(
const NativeDecisionContext& context,
1178 std::uint64_t except_incarnation = 0)
const;
1179 bool carried_pooc_short_margin_before_script_scope(
1180 const NativeDecisionContext&)
const;
1181 bool carried_pooc_short_priced_exit_after_adverse_scope(
1183 bool defer_rounded_pooc_short_margin_until_close(
const Bar&)
const;
1184 bool declined_reversal_at_open(
const Bar&)
const;
1185 bool schedule_margin_call_path(
const Bar&,
const NativeDecisionContext&);
1186 void defer_declined_reversal_exits_at_adverse(
const Bar&,
1187 const NativeDecisionContext&,
1188 bool margin_scheduled);
1189 bool intraday_loss_breached(
double mark_price)
const noexcept;
1190 bool submit_intraday_loss_close(
double mark_price,
const NativeDecisionContext&,
1191 bool execute_current);
1192 void schedule_intraday_loss_path(
const Bar&,
const NativeDecisionContext&);
1193 void update_risk_state(
double mark_price);
1194 bool intraday_loss_orders_blocked() const noexcept;
1195 compat::pine::CapClock cap_clock(const NativeDecisionContext&) const;
1196 compat::pine::Calculation cap_calculation(const NativeDecisionContext&) const;
1197 compat::pine::MatchedAttempt cap_attempt(
1198 const PlacementSnapshot&, std::uint64_t incarnation,
1199 const native_order::ExecutionAppliedEvent* applied =
nullptr) const;
1200 bool cap_placement_denied(const NativeDecisionContext&);
1201 void observe_intraday_cap(const native_order::ExecutionAppliedEvent&,
1202 const PlacementSnapshot&, const NativeDecisionContext&);
1203 void observe_intraday_cap_noop(
bool is_long, const NativeDecisionContext&);
1204 void execute_cap_close_now(const compat::pine::CloseNow&);
1205 void execute_due_cap_close(const NativeDecisionContext&);
1206 void maybe_activate_short_seed_plan();
1207 void activate_short_seed_plan_at_open(const NativeDecisionContext&);
1208 bool qualify_short_seed_plan(const ShortSeedPlan&) const;
1209 bool short_seed_context_is_live() const noexcept;
1210 void record_dropped_close(const
SourceId&, const std::
string&,
double,
double,
1211 bool, std::uint64_t);
1212 void record_opening_fee(const PlacementSnapshot&,
1213 const native_order::ExecutionAppliedEvent&);
1214 void consume_opening_fees(const native_order::ExecutionAppliedEvent&,
1216 void consume_cohort_units(const
SourceId&, const native_order::ExecutionAppliedEvent&);
1217 void consume_closed_trade_rows(const native_order::ExecutionAppliedEvent&,
1218 const PlacementSnapshot*);
1219 bool origin_is_pending(const native_order::RequestHandle&) const noexcept;
1224 std::vector<std::
size_t> live_origin_positions(const CohortFacts&) const;
1225 void cancel_bracket_origin(native_order::RequestHandle);
1226 void cancel_bracket_siblings(native_order::RequestHandle);
1227 void cancel_exit_orders_for_full_close(const
SourceId& from_entry);
1228 void retire_in_position_exits_at_flat(
bool preserve_pending_parents,
1229 bool dormant_rows_only,
1230 const PlacementSnapshot* paired_close);
1231 void materialize_relative_exits(PlacementSnapshot,
1232 const native_order::ExecutionAppliedEvent&);
1233 void withdraw_anchored_relative_legs(const
SourceId* exit_id,
1235 bool anchorable_relative_exit(const PendingRelativeExit&,
1236 native_order::RequestHandle& parent,
1237 bool& parent_long) const;
1238 struct RelativeLegShape {
1241 double signed_ticks = 0.0;
1242 double operand_ticks = 0.0;
1244 std::vector<RelativeLegShape> relative_leg_shapes(
const PendingRelativeExit&,
1245 bool parent_long)
const;
1246 bool armed_relative_legs_adoptable(
const PlacementSnapshot& opening,
1247 const native_order::ExecutionAppliedEvent&,
1248 const std::vector<PendingRelativeExit>&)
const;
1253 double exit_limit_trigger(
double limit_price,
double tick,
bool exit_is_buy)
const noexcept;
1254 double one_shot_trail_trigger(
double activation,
double source_trail_offset,
double tick,
1255 bool exit_is_buy,
bool quantized_activation)
const noexcept;
1256 void materialize_pending_bracket_legs(
1257 const native_order::ExecutionAppliedEvent&);
1258 void stage_flat_children_before_parent(
const SourceId&, std::int32_t,
1260 bool defer_coof_tail() const noexcept;
1261 bool source_path_uses_high_first(const Bar&) const noexcept;
1262 bool coof_fill_on_path_point() const noexcept;
1263 bool coof_fill_at_path_point(
double waypoint) const noexcept;
1264 bool coof_current_fill_was_forced_waypoint() const noexcept;
1265 double coof_next_waypoint(
int* path_index =
nullptr) const noexcept;
1266 double next_coof_waypoint_price() const noexcept;
1267 bool coof_remaining_recrosses(
double level,
bool long_position) const noexcept;
1268 void flush_coof_tail(
bool openings_only = false,
1269 bool include_next_open = false);
1270 native_order::Owner owner_for_close(const
SourceId&,
bool dynamic) const;
1271 bool same_bar_market_tx_scope() const;
1272 void flush_pending_same_bar_commands();
1278 double default_sizing_units(const PineSizingSnapshot&) const;
1283 double default_sizing_cash(const PineSizingSnapshot&) const noexcept;
1284 bool default_sizing_reserves_percent_fee() const noexcept;
1285 double default_sizing_lot_floor(
double units) const noexcept;
1290 std::optional<native_order::Sized> default_sizing_shape(
1291 const PineSizingSnapshot&) const noexcept;
1292 std::optional<native_order::Sized> default_sizing_intent(
1293 const PineSizingSnapshot&,
bool is_long) const noexcept;
1299 bool core_sizing_price_matches(const PineSizingSnapshot&,
bool is_long) const;
1300 double default_market_sizing_price(
double mark,
bool is_long) const noexcept;
1301 native_order::Trigger trigger_for(
double limit_price,
double stop_price) const;
1302 native_order::Group group_for(const std::
string&,
int, std::int64_t = 0) const;
1303 PineSizingSnapshot sizing_snapshot() const;
1304 std::uint64_t key_for(const
SourceId&, const
SourceId& = {})
const noexcept;
1305 void refresh_pending_view() noexcept;
1306 OrderBirth capture_order_birth() const;
1307 void initialize_l4c_policy(PlacementSnapshot&, native_order::RequestHandle);
1308 void update_l4c_priority();
1309 void update_l4c_lifecycle(const native_order::ExecutionAppliedEvent&,
1310 const NativeDecisionContext&);
1311 using ReceiptHighWaterReader = std::uint64_t (*)(const NativeStrategyHost&) noexcept;
1312 void set_receipt_high_water_readers(ReceiptHighWaterReader event_reader,
1313 ReceiptHighWaterReader terminal_reader) noexcept;
1317 std::uint64_t terminal_receipt_cursor_ = 0;
1318 ReceiptHighWaterReader event_high_water_reader_ =
nullptr;
1319 ReceiptHighWaterReader terminal_receipt_high_water_reader_ =
nullptr;
1320 bool is_declined_market_reversal(
1321 const native_order::MatchRejectedEvent&) const noexcept;
1322 bool follows_same_bar_declined_reversal(
1323 const PlacementSnapshot&, const NativePrecommitView&) const;
1324 bool bracket_belongs_to_reversal(
1325 const PlacementSnapshot&, const PlacementSnapshot&) const noexcept;
1326 void suspend_brackets_for_reversal(
1327 const PlacementSnapshot&, const exit_legs::Frame&,
double open_price);
1328 void suspend_declined_reversal_brackets(
1329 const native_order::MatchRejectedEvent&);
1330 void suspend_coof_declined_reversal_at_open(
1331 const Bar&, const NativeDecisionContext&);
1332 void hold_reversal_pair_brackets(const
SourceId&);
1333 void purge_brackets_after_applied_reversal(const PlacementSnapshot&);
1334 void revive_brackets_after_margin(
1335 const native_order::ExecutionAppliedEvent&, const NativeDecisionContext&);
1336 int projected_pending_size() const noexcept;
1337 bool projected_pending_at(
int index, const PlacementSnapshot*& snapshot,
1338 native_order::RequestHandle& handle) const noexcept;
1339 int projected_raw_pending_size() const noexcept;
1340 bool projected_raw_pending_at(
int index, const PlacementSnapshot*& snapshot,
1341 native_order::RequestHandle& handle) const noexcept;
1342 static
bool same_projected_order(const PlacementSnapshot& left,
1343 const PlacementSnapshot& right) noexcept;
1344 void apply_open_market_admission(const NativeDecisionContext&);
1345 void defer_open_marketable_sells(const Bar& bar);
1346 void admit_deferred_open_marketable_sells();
1347 void rearm_throttled_reopens();
1348 void flush_pooc_marketable_limit_entry_fills(const Bar&, const NativeDecisionContext&);
1349 void flush_pooc_marketable_exit_fills(const Bar&, const NativeDecisionContext&);
1350 void record_market_review(admission::Checkpoint,
int,
1351 const std::vector<native_order::RequestHandle>&);
1352 void refresh_pending_sizing_after_margin(
1353 const native_order::ExecutionAppliedEvent&, const NativeDecisionContext&);
1354 void apply_reversal_gap_bracket_policy(
1355 const Bar&, const NativeDecisionContext&,
bool defer_trails = false);
1356 void reaccept_gapped_bracket_behind_same_id_add(
1357 const Bar&, const NativeDecisionContext&);
1358 void apply_terminal_explicit_market_policy(const NativeDecisionContext&);
1359 bool enqueue_pooc_fifo_close(const
SourceId&, const std::
string&,
1360 std::uint64_t, std::uint64_t);
1361 double close_reserved_other_units(const
SourceId&,
1362 std::uint64_t) const noexcept;
1363 void observe_close_policy(const native_order::ExecutionAppliedEvent&,
1364 const PlacementSnapshot&);
1367 NativeStrategyHost* host_ =
nullptr;
1368 PineStrategyConfig config_{};
1369 StagedConfiguration staged_{};
1371 mutable std::uint64_t run_counter_ = 0;
1372 std::uint64_t source_sequence_ = 0;
1373 std::uint64_t command_ordinal_ = 0;
1374 std::uint64_t broker_open_epoch_ = 0;
1375 std::int64_t last_broker_open_ms_ = std::numeric_limits<std::int64_t>::min();
1376 std::uint64_t source_command_sequence_ = 0;
1377 std::int32_t entry_attempt_bar_ = -1;
1378 std::uint32_t entry_attempts_on_bar_ = 0;
1379 std::unordered_map<SourceId, CohortFacts> cohorts_by_id_;
1380 std::vector<SourceId> cohort_order_;
1381 PlacementTable placement_;
1382 std::unordered_map<std::uint64_t, native_order::RequestHandle> live_by_source_key_;
1383 std::unordered_map<std::uint64_t, BracketRoster> bracket_families_;
1384 std::vector<PendingBracketLeg> pending_bracket_legs_;
1385 std::vector<PendingEntry> pending_entries_;
1386 std::vector<DelayedMarketOrder> delayed_market_orders_;
1387 std::vector<DeferredOpenMarketableSell> deferred_open_marketable_sells_;
1390 mutable std::vector<PlacementSnapshot> throttled_reopen_rearm_;
1391 int entry_openings_interval_index_ = -1;
1392 int entry_openings_this_interval_ = 0;
1393 std::vector<PendingSameBarCommand> pending_same_bar_commands_;
1394 std::vector<SourceShadowPending> source_shadow_pending_;
1395 double pending_same_bar_close_qty_ = 0.0;
1396 std::vector<PendingRelativeExit> pending_relative_exits_;
1399 mutable std::vector<AnchoredRelativeLeg> anchored_relative_legs_;
1401 std::int64_t anchored_cohort_sequence_ = 0;
1402 std::vector<PendingCoofRequest> pending_coof_requests_;
1403 std::vector<PendingMarginRevival> pending_margin_revivals_;
1404 std::vector<native_order::RequestHandle> live_handles_;
1405 std::vector<native_order::RequestHandle> first_open_newborns_;
1406 std::vector<DroppedCloseReceipt> dropped_close_receipts_;
1407 std::vector<OpenEntryFeeFact> open_entry_fees_;
1412 std::unordered_set<std::uint64_t> current_debited_applied_ordinals_;
1413 std::unordered_set<std::uint64_t> intraday_loss_relabel_ordinals_;
1414 std::unordered_map<SourceId, std::int64_t> consumed_partial_exit_cycles_;
1415 std::unordered_set<std::uint64_t> bracket_shadowed_openings_;
1416 std::unordered_map<SourceId, NamedEntryCancelToken> named_entry_cancel_tokens_;
1417 std::map<SourceId, double> close_logical_units_;
1418 std::map<SourceId, double> close_reserved_units_;
1419 std::map<SourceId, double> close_first_units_;
1420 std::map<std::uint64_t, std::map<SourceId, double>>
1421 close_callsite_reserved_units_;
1422 std::map<std::uint64_t, std::map<SourceId, double>>
1423 close_callsite_first_units_;
1424 std::map<std::uint64_t, CloseCallsiteState> close_batch_callsites_;
1425 std::int32_t close_batch_bar_ = -1;
1426 std::uint64_t close_batch_queue_sequence_ = 0;
1427 double close_batch_pending_debt_ = 0.0;
1428 double close_batch_admitted_total_ = 0.0;
1429 std::uint64_t receipt_cursor_ = 0;
1430 std::uint64_t last_applied_ordinal_ = 0;
1431 bool materializing_relative_ =
false;
1434 native_order::RequestHandle materializing_parent_{};
1435 std::int64_t current_position_cycle_ = 0;
1436 int current_position_sign_ = 0;
1437 std::uint64_t next_sequential_group_ = 0;
1438 bool source_batch_mutated_ =
false;
1439 bool coof_recalc_active_ =
false;
1440 bool coof_first_open_ =
false;
1441 std::uint64_t coof_market_entry_recalc_incarnation_ = 0;
1442 std::uint64_t coof_market_entry_recalc_fill_seq_ = 0;
1443 std::uint64_t coof_current_fill_seq_ = 0;
1444 double coof_fill_cursor_t_ = std::numeric_limits<double>::quiet_NaN();
1445 NativeDecisionContext coof_context_{};
1446 Bar coof_script_bar_{};
1447 bool coof_script_bar_valid_ =
false;
1448 std::unordered_map<std::int64_t, double> pooc_close_basis_by_script_bar_;
1449 double pooc_open_basis_ = 0.0;
1450 std::int64_t pooc_open_script_bar_ = std::numeric_limits<std::int64_t>::min();
1451 std::int64_t close_all_pending_script_bar_ = std::numeric_limits<std::int64_t>::min();
1452 double last_fx_rate_ = std::numeric_limits<double>::quiet_NaN();
1453 std::int64_t position_open_script_bar_ = std::numeric_limits<std::int64_t>::min();
1454 std::uint64_t position_open_epoch_ = 0;
1455 std::int32_t position_open_bar_index_ = -1;
1457 bool position_open_priced_ =
false;
1458 std::int64_t last_margin_call_script_bar_ = std::numeric_limits<std::int64_t>::min();
1472 std::uint64_t kernel_margin_path_point_ = std::numeric_limits<std::uint64_t>::max();
1480 std::uint64_t kernel_margin_resize_point_ = std::numeric_limits<std::uint64_t>::max();
1483 std::int64_t pooc_close_checkpoint_deferred_ms_ = std::numeric_limits<std::int64_t>::min();
1484 std::int32_t signal_close_mc_event_bar_ = -1;
1485 std::int64_t signal_close_mc_position_cycle_ = 0;
1486 std::uint64_t signal_close_mc_entry_incarnation_ = 0;
1487 std::uint64_t signal_close_mc_fill_seq_ = 0;
1488 double signal_close_mc_before_qty_ = std::numeric_limits<double>::quiet_NaN();
1489 double signal_close_mc_remaining_qty_ = std::numeric_limits<double>::quiet_NaN();
1490 std::uint64_t last_margin_call_event_ordinal_ = 0;
1491 std::uint64_t last_margin_call_entry_incarnation_ = 0;
1492 std::int64_t last_margin_call_position_cycle_ = 0;
1493 bool last_margin_call_at_script_close_ =
false;
1494 double last_margin_call_closed_units_ = 0.0;
1495 double last_margin_call_remaining_units_ = 0.0;
1496 std::int64_t risk_coof_direct_script_bar_ = std::numeric_limits<std::int64_t>::min();
1497 std::uint64_t cap_latest_fill_ = 0;
1498 bool source_margin_call_enabled_ =
true;
1499 Bar policy_script_bar_{};
1500 bool policy_script_bar_valid_ =
false;
1501 std::unordered_set<std::uint64_t> market_pyramid_adds_;
1502 std::unordered_map<std::uint64_t, NativeTrailState> trail_state_at_open_;
1503 bool stream_mode_ =
false;
1504 SourceDayLedger day_ledger_{};
1505 PineRiskState risk_{};
1506 ShortSeedPlan short_seed_{};
1507 PendingShortSeedPlan pending_short_seed_{};
1508 native_order::RequestHandle short_seed_long_candidate_{};
1509 int last_bar_dual_entry_path_ = 0;
1510 std::int64_t last_bar_dual_entry_script_open_ms_ =
1511 std::numeric_limits<std::int64_t>::min();
1513 std::vector<std::uint8_t> trade_exit_phase_;
1518 bool bar_magnifier_ =
false;