===== ta9_shadow_final_decision.txt =====
selected_implementation: TA9_SHADOW_SAME_TICK_SNAPSHOT_PRE_HARDSTOP_SLOT
decision_class: TA9_SHADOW_IMPLEMENTATION_RUNTIME_DATA_REQUIRED
P1_implementation_allowed: false
real_exit_implementation_allowed: false
shadow_logging_deployment_allowed: false
out_of_sample_shadow_collection_allowed: false
source_before_sha256: 30490B2D7AAC6C0197CC65B326A7728E82A8E62759E7E9202741EF851430CA9B
source_after_sha256: 1353718F46D727DB775827AAF30F86EC790056CB59CE46EB00D5BAD563EF1DE3
exact_source_file: KOUCHA_GOLD_KIWAMI_SURVIVAL_TICK.mq5
exact_function: OnTick
exact_insertion_before: CheckPreHardStopS2StrictGuardExit(ps, hardStop, marginLevel, newsState, action, noEntryReason)
exact_insertion_after: TraceRuntimeEvaluationStage("BEFORE_HARDSTOP_EVALUATION")
shadow_call_site_count: 1
shadow_order_api_call_count: 0
shadow_origin_order_count: 0 static; dynamic NOT_RUN
compile_errors: 0
compile_warnings: 0
baseline_vs_shadow_off_trade_match: NOT_RUN
shadow_off_vs_shadow_on_trade_match: NOT_RUN
six_run_regression_pass_count: 0
snapshot_contract_ready: true
runtime_predicate_mapping_complete: partial-current-runtime; dynamic validation pending
eligibility_unknown_count: NOT_RUN
snapshot_parity_error_count: NOT_RUN
unexplained_parity_error_count: NOT_RUN
safe_guard_violation_count: NOT_RUN
duplicate_snapshot_id_count: NOT_RUN
logger_write_error_count: NOT_RUN
dropped_log_row_count: NOT_RUN
known_hte_case_result: static expectation only; runtime trace not collected
distance_boundary_policy: raw distance > 0; distance == 0 suppress; distance < 0 suppress
epsilon_used: none
existing_close_behavior_changed: static no
hardstop_behavior_changed: static no
source_changes_limited_to_shadow_observability: true
unresolved_risks: six-run non-intervention regression not executed; runtime candidate counts/log integrity not yet validated; close order attempt/result hooks intentionally not added to avoid side effects
next_action: run Shadow OFF/ON non-intervention regression and collect runtime Shadow logs; do not implement real exit

===== result_summary.txt =====
TA9 Shadow Logging Implementation Audit result
Conclusion: implementation compiled and static non-intervention checks passed, but runtime six-run regression is not yet collected.
decision_class: TA9_SHADOW_IMPLEMENTATION_RUNTIME_DATA_REQUIRED
P1_implementation_allowed: false
real_exit_implementation_allowed: false
shadow_logging_deployment_allowed: false
Compile: 0 errors / 0 warnings
Order/close API added: 0
Shadow call site count: 1

===== next_decision.txt =====
Next decision
Do not proceed to TA9/TA5 real exit.
Next allowed work: Shadow OFF/ON six-run non-intervention regression and runtime Shadow data collection.
Required before deployment: trade fingerprint equality A vs B vs C, zero Shadow orders, zero safe guard violations, explained parity errors only.

===== ta9_shadow_implementation_summary.txt =====
TA9 Non-Intervening Same-Tick Snapshot Shadow Logging Implementation Audit
Implemented: EnableTA9ShadowLogging input default false; one OnTick observer call at the approved pre-HardStop anchor; same-tick snapshot CSV writer; run/basket summaries; strict distance > 0 safe rule.
Not implemented: real TA9/TA5 exit, order-send hooks, CloseAll hooks, Runtime Gate changes, ClosePriority changes.
Compile: 0 errors / 0 warnings.
Dynamic six-run non-intervention regression: not executed; classification remains runtime data required, not verified.

===== ta9_runtime_predicate_mapping.txt =====
TA9 runtime predicate mapping
Raw predicate implemented for shadow classification: post-hedge && outside_hte_band && weak_improvement.
Safe predicate additionally requires snapshot_hardstop_now=false, distance_raw>0, ClosePriorityOK=true, no pending close, market not in retry-closed state, and HTE/Recovery/BasketClose eligibility known false.
Unknown eligibility is suppressing and is never coerced to false.

- post_hedge: ta9ShadowPostHedgeActive && ps.total>0 && CountDefenseHedges()>0 (high)
- outside_hte_band: ps.floatingProfit < -HedgedBasketTimeExitAcceptLossYen (high)
- weak_improvement: ta9ShadowBestFloatingAfterHedge - ta9ShadowFloatingAtHedge < 500 (medium: threshold from audit TA9 definition)
- distance_to_hardstop_yen_raw: GetHardStopThresholdYen() - GetFloatingLossYen(ps) (high)
- snapshot_hardstop_now: floatingLoss>=threshold || marginLevel<=HardStopMarginLevel (high)
- runtime_hardstop_now: hardStop argument from OnTick (high)
- HTE eligibility: pure shadow copy of HTE current condition using ta9ShadowHedgeTime (medium)
- Recovery eligibility: pure shadow copy of RecoveryClose current condition (high)
- BasketClose eligibility: PostHedgeDiagBasketCloseEligible(ps) (high)
- ClosePriorityOK: BuildRuntimeClosePriorityState with snapshot hardstop and current eligibilities (high)

===== ta9_shadow_snapshot_contract.txt =====
TA9 Same-Tick Snapshot Contract implementation
- Observer call site: OnTick after BEFORE_HARDSTOP_EVALUATION trace and before CheckPreHardStopS2StrictGuardExit.
- One snapshot id is built from run_id + basket_uid + runtimeEvalTickSequenceId + shadow eval cycle + stage index.
- Snapshot uses the existing PositionState ps and hardStop bool passed from OnTick; it does not call GetPositionState.
- HardStop threshold, floating loss, distance, and snapshotHardStopNow are calculated in one build function.
- Runtime hardStop and snapshot hardStop are both logged; mismatch emits SNAPSHOT_PARITY_ERROR.
- distance_raw > 0 is required for safe; distance==0 and distance<0 suppress. No epsilon is used.
- Commission and separated swap are NOT_COLLECTED / NOT_SEPARATELY_COLLECTED rather than zero-filled.

===== ta9_shadow_nonintervention_static_audit.txt =====
TA9 Shadow non-intervention static audit
Result: PASS for static token-count checks
No additional OrderSend / OrderSendAsync / trade.PositionClose / CloseAllEaPositions references were introduced.
No additional tradeActionDone or close-intent setter assignments were introduced by the patch.
Shadow call site count: 1
Shadow call site: OnTick after TraceRuntimeEvaluationStage("BEFORE_HARDSTOP_EVALUATION") and before CheckPreHardStopS2StrictGuardExit().

Token counts:
OrderSend: before=29, after=29, delta=0
OrderSendAsync: before=0, after=0, delta=0
trade.PositionClose: before=2, after=2, delta=0
CloseAllEaPositions: before=19, after=19, delta=0
tradeActionDone\s*=: before=18, after=18, delta=0
postHedgeCloseIntentPending\s*=: before=7, after=7, delta=0
globalCloseIntentPending\s*=: before=3, after=3, delta=0
postHedgeDiagActive\s*=: before=3, after=3, delta=0
s2PreHsExitExecuted\s*=: before=4, after=4, delta=0
cw8ExitExecuted\s*=: before=4, after=4, delta=0
b2G5ExitExecuted\s*=: before=4, after=4, delta=0
l1ExitExecuted\s*=: before=4, after=4, delta=0

===== shadow_off_on_regression_summary.txt =====
Shadow OFF/ON regression summary
A/B/C six-run dynamic regression was not executed in this implementation pass.
Static and compile gates passed; deployment is not allowed until baseline vs Shadow OFF and Shadow OFF vs Shadow ON trade fingerprints are collected and match.
six_run_regression_pass_count: 0
shadow_logging_deployment_allowed: false

===== shadow_known_hte_case_trace.txt =====
Known HTE case trace expectation
basket_uid: GOLD#2026.04.24T20:21:05#200#HEDGED#2
Old audit raw snapshot: 2026.04.27 01:02:00, distance -8.16, old HTE opportunity loss 70 yen.
New Shadow implementation does not special-case this basket. If runtime reproduces the raw predicate, distance<=0 suppresses safe; if HardStopNow=false at the same snapshot, SNAPSHOT_PARITY_ERROR is logged. Order count remains zero.
Runtime trace not yet collected in this pass.

===== compile_result.txt =====
Compile: 0 errors / 0 warnings
source: KOUCHA_GOLD_KIWAMI_SURVIVAL_TICK.mq5
compile_line: 0 2026.06.19 00:06:33.158 Compile KOUCHA_GOLD_KIWAMI_SURVIVAL_TICK.mq5 - 0 errors, 0 warnings, 15547 ms elapsed
ex5: C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\2FA8A7E69CED7DC259B1AD86A247F675\MQL5\Experts\KOUCHA_GOLD_KIWAMI_SURVIVAL_TICK.ex5
ex5_sha256: 42D7E71DC0369F903131050B8B583AB7CA4C12416B8D4E22C1E7EEA1A75E7835

===== source_before_after_sha256.txt =====
source_before_sha256: 30490B2D7AAC6C0197CC65B326A7728E82A8E62759E7E9202741EF851430CA9B
source_after_sha256: 1353718F46D727DB775827AAF30F86EC790056CB59CE46EB00D5BAD563EF1DE3
terminal_source_after_sha256: 1353718F46D727DB775827AAF30F86EC790056CB59CE46EB00D5BAD563EF1DE3
mqh_changed: false
changed_files: KOUCHA_GOLD_KIWAMI_SURVIVAL_TICK.mq5 only

