22#include "../native_execution_consumer.hpp"
170 std::vector<PineIntentRow>
rows;
179 "selected pre-roll command outside its capture bracket");
183 "selected pre-roll capture without a live callback point");
187 "selected pre-roll evaluation without its intent state");
191 "selected run begin without a running spec for its intent state");
198 return NativeExecutionConsumer::bound(host).current_point();
207 if (!NativeExecutionConsumer::selected_window_admitted(host, &window))
return nullptr;
208 const NativeExecutionConsumer& consumer = NativeExecutionConsumer::bound(host);
209 if (!consumer.running())
return nullptr;
210 NativeHostState*
const parked = consumer.host_state();
225 return state !=
nullptr ? state->
replay_point :
nullptr;
235 if (!NativeExecutionConsumer::selected_window_admitted(host, &window))
return;
236 NativeExecutionConsumer& consumer = NativeExecutionConsumer::bound(host);
239 consumer.adopt_host_state(
250template <
class MakePayload>
254 if (!NativeExecutionConsumer::selected_window_admitted(host, &window)
255 || label_ms >= window.start_ms) {
268template <
class Payload>
272 if (state ==
nullptr || !state->
capturing)
return;
275 state->
rows.push_back(
PineIntentRow{std::forward<Payload>(payload), config, *point});
287 std::int64_t label_ms) {
290 if (!NativeExecutionConsumer::selected_window_admitted(host, &window)
291 || label_ms >= window.start_ms) {
311 state.has_evaluation =
true;
312 state.capturing =
false;
313 state.replayed =
false;
314 state.label_ms = label_ms;
315 state.start_config = config;
316 state.end_config = config;
317 state.start_risk = risk;
318 state.end_risk = risk;
319 state.terminal_point = point;
327 : host_(&host), opened_(opened) {}
331 if (!opened_)
return;
Base with a code: throw coded<std::invalid_argument>(code, {args}, text).
The public native host: an abstract subclass of BacktestEngine with no PineScript on it.
IntentCaptureScope & operator=(const IntentCaptureScope &)=delete
IntentCaptureScope(const IntentCaptureScope &)=delete
IntentCaptureScope(const NativeStrategyHost &host, bool opened) noexcept
void intent_without_state()
PineIntentState * selected_intents(const NativeStrategyHost &host) noexcept
void intent_without_spec()
void reset_intent_evaluation(PineIntentState &state, std::int64_t label_ms, const PineStrategyConfig &config, const PineReplayRiskConfig &risk, const NativeCurrentPointView &point) noexcept
const NativeCurrentPointView * selected_replay_point(const NativeStrategyHost &host) noexcept
void intent_without_point()
std::variant< IntentEntry, IntentClose, IntentCloseToken, IntentCloseAll, IntentExit, IntentExitCancelBracket, IntentCancel, IntentCancelAll, IntentOrder, IntentRiskDirection, IntentRiskMaxConsLossDays, IntentRiskMaxDrawdown, IntentRiskMaxIntradayLoss, IntentRiskMaxIntradayFilledOrders, IntentRiskMaxPositionSize > PineIntentPayload
bool capture_pre_roll_command(const NativeStrategyHost &host, std::int64_t label_ms, const PineStrategyConfig &config, MakePayload &&make_payload)
PreRollEvaluation selected_pre_roll_evaluation(const NativeStrategyHost &host, std::int64_t label_ms)
void intent_outside_bracket()
const char kPineIntentStateKind
void adopt_selected_intents(NativeStrategyHost &host)
const NativeCurrentPointView * intent_live_point(const NativeStrategyHost &host) noexcept
void capture_risk_row(const NativeStrategyHost &host, const PineStrategyConfig &config, Payload &&payload)
Selected-window configuration, handed to strategy_set_selected_window_v1().
What current_execution_point() answers inside a callback: the point's decision context,...
One complete setup value, staged/copied by NativeStrategyHost before it is applied at begin.
native_order::RunIdentity identity
std::uint64_t callsite_token
PineStrategyConfig config
NativeCurrentPointView point
PineIntentPayload payload
std::vector< PineIntentRow > rows
PineReplayRiskConfig start_risk
PineIntentState(const NativeStrategyHost *owner_host, std::uint64_t native_run) noexcept
const NativeCurrentPointView * replay_point
PineStrategyConfig start_config
NativeCurrentPointView terminal_point
PineStrategyConfig end_config
PineReplayRiskConfig end_risk
const NativeStrategyHost * owner
const NativeCurrentPointView * point