===== timing_alignment_candidate_safety_summary.txt =====
Pre-HardStop Timing Alignment Candidate Safety Comparison Audit

Input verification:
- latest.zip SHA256 expected: 01574CC3481878A15B11B54ECC866E8618C33E9715D36AA22E8B1F6058F037D4
- latest.zip SHA256 actual:   01574CC3481878A15B11B54ECC866E8618C33E9715D36AA22E8B1F6058F037D4
- SHA256 match: True

Calculation formulas:
- hardstop_reduction_yen = virtual_exit_profit_yen - actual_final_profit_yen
- killed_future_profit_yen = actual_final_profit_yen - virtual_exit_profit_yen
- net_effect_after_kills_yen = hardstop_reduction_yen + unresolved_effect_yen - killed_future_profit_yen
- adoption rows are limited to HardStopNow=false / ClosePriorityOK=true / ClosePriorityBlocked=false executable snapshots.

Overall comparison:
plan | eligible_baskets | hardstop_rescue | hte_kill | net | maxdd | worst_log | positive_logs | max_1_log_dep | max_1_basket_dep
TA9 | 30 | 26 | 1 | 32760.00 | 2374.00 | 2616.00 | 6/6 | 29.29% | 7.25%
TA5 | 21 | 20 | 0 | 20063.00 | 1602.00 | 0.00 | 5/6 | 32.93% | 7.98%
TA4 | 16 | 16 | 0 | 14003.00 | 1358.00 | 0.00 | 3/6 | 46.75% | 9.70%

By-log comparison:
plan | period | deposit | baskets | hardstop | hte_kill | unresolved | net | share
TA9 | 2026.03.01-2026.05.29 | 100000 | 5 | 5 | 0 | 0 | 9594.00 | 29.29%
TA5 | 2026.03.01-2026.05.29 | 100000 | 1 | 1 | 0 | 0 | 1544.00 | 7.70%
TA4 | 2026.03.01-2026.05.29 | 100000 | 0 | 0 | 0 | 0 | 0.00 | 0.00%
TA9 | 2026.03.01-2026.05.29 | 50000 | 9 | 8 | 1 | 0 | 6231.00 | 19.02%
TA5 | 2026.03.01-2026.05.29 | 50000 | 8 | 8 | 0 | 0 | 6301.00 | 31.41%
TA4 | 2026.03.01-2026.05.29 | 50000 | 8 | 8 | 0 | 0 | 6301.00 | 45.00%
TA9 | 2026.04.01-2026.05.29 | 100000 | 4 | 3 | 0 | 1 | 4984.00 | 15.21%
TA5 | 2026.04.01-2026.05.29 | 100000 | 2 | 2 | 0 | 0 | 2996.00 | 14.93%
TA4 | 2026.04.01-2026.05.29 | 100000 | 0 | 0 | 0 | 0 | 0.00 | 0.00%
TA9 | 2026.04.01-2026.05.29 | 50000 | 7 | 7 | 0 | 0 | 6606.00 | 20.16%
TA5 | 2026.04.01-2026.05.29 | 50000 | 7 | 7 | 0 | 0 | 6606.00 | 32.93%
TA4 | 2026.04.01-2026.05.29 | 50000 | 7 | 7 | 0 | 0 | 6546.00 | 46.75%
TA9 | 2026.05.01-2026.05.29 | 100000 | 2 | 1 | 0 | 1 | 2729.00 | 8.33%
TA5 | 2026.05.01-2026.05.29 | 100000 | 0 | 0 | 0 | 0 | 0.00 | 0.00%
TA4 | 2026.05.01-2026.05.29 | 100000 | 0 | 0 | 0 | 0 | 0.00 | 0.00%
TA9 | 2026.05.01-2026.05.29 | 50000 | 3 | 2 | 0 | 1 | 2616.00 | 7.99%
TA5 | 2026.05.01-2026.05.29 | 50000 | 3 | 2 | 0 | 1 | 2616.00 | 13.04%
TA4 | 2026.05.01-2026.05.29 | 50000 | 1 | 1 | 0 | 0 | 1156.00 | 8.26%

TA9 HTE Kill:
- TA9 raw has 1 HTE Kill, 70 yen opportunity loss.
- The killed basket is the only TA9 row with distance_to_hardstop_yen < 0 at the executable snapshot.
- The effect ratio is small: 70 / 32297 gross HardStop benefit = 0.22%.
- Count alone should not reject TA9, but raw TA9 still needs safety filtering and priority-slot approval.

TA9 added profit source:
- TA9 rescues 26 HardStop baskets versus TA5 20 and TA4 16.
- TA9 is positive in all six logs and covers both 50k and 100k; TA5 has one zero log and TA4 is 50k-only in this dataset.
- TA9 raw net advantage over TA5 is 12,697 yen; over TA4 is 18,757 yen.

Safe filter search:
- TA9_FILTER_DISTANCE_TO_HARDSTOP_NONNEG: net 32830.00, hardstop 26, HTE Kill 0, TA5 diff 12767.00, overfit medium
- TA9_FILTER_DISTANCE_TO_HTE_LE_NEG500: net 29196.00, hardstop 21, HTE Kill 0, TA5 diff 9133.00, overfit medium-high
- TA9_FILTER_FLOATING_LE_NEG2500: net 26596.00, hardstop 18, HTE Kill 0, TA5 diff 6533.00, overfit medium-high
- TA9_FILTER_FLOATING_LE_NEG3000: net 22095.00, hardstop 13, HTE Kill 0, TA5 diff 2032.00, overfit high
- TA9_FILTER_DISTANCE_HS_0_TO_1500: net 20063.00, hardstop 20, HTE Kill 0, TA5 diff 0.00, overfit medium-high
- TA9_FILTER_SPREAD_LE_070: net 32830.00, hardstop 26, HTE Kill 0, TA5 diff 12767.00, overfit medium

Best safety adjustment:
- TA9_FILTER_DISTANCE_TO_HARDSTOP_NONNEG: distance_to_hardstop_yen >= 0
- Filtered net effect: 32830.00
- HTE Kill: 0
- TA5 advantage: 12767.00
- This uses a realtime candidate-snapshot field and does not reference final_close_reason, basket id, period, or future hardstop time.

Leave-One-Log-Out:
- TA9: min 23166.00, max 30144.00, avg 27300.00, sign reversal False
- TA5: min 13457.00, max 20063.00, avg 16719.17, sign reversal False
- TA4: min 7457.00, max 14003.00, avg 11669.17, sign reversal False

Overlap summary:
- ALL_THREE: count 16, hardstop 16, hte 0, TA9 net 14135.00, TA5 net 14135.00, TA4 net 14003.00
- TA9_ONLY: count 9, hardstop 6, hte 1, TA9 net 12697.00, TA5 net 0.00, TA4 net 0.00
- TA9_TA5_ONLY: count 5, hardstop 4, hte 0, TA9 net 5928.00, TA5 net 5928.00, TA4 net 0.00

Recommendation:
- selected_plan: TA9_SAFE_DISTANCE_TO_HARDSTOP_NONNEG
- decision_class: TA9_DESIGN_REQUIRED
- P1_implementation_allowed: false
- Rationale: TA9 has superior corrected effect and a plausible realtime safety filter, but still needs explicit POST_HEDGE_SLOT / priority-order design approval.
- Fallback: TA5_P1_CANDIDATE if priority-order change risk is not accepted.

Residual risks and data gaps:
- RECOVERY_CLOSE and BASKET_CLOSE counts are zero in the six-log sample, so Kill 0 for those paths must not be over-generalized.
- TA9 safety filter should be parity-logged in runtime because distance_to_hardstop_yen negative/positive sign is a same-tick edge.
- No code/EA logic changes were made in this audit.


===== timing_alignment_final_decision.txt =====
selected_plan: TA9_SAFE_DISTANCE_TO_HARDSTOP_NONNEG
decision_class: TA9_DESIGN_REQUIRED
P1_implementation_allowed: false
reason: TA9 has the strongest effect and the HTE Kill can be removed by a real-time field filter, but implementation still needs a POST_HEDGE_SLOT / priority-order design decision before P1.
required_runtime_slot: POST_HEDGE_SLOT or explicit Pre-HardStop slot with shared ClosePriority snapshot
priority_order_change_required: true
HTE_kill_count: 0
HTE_kill_yen: 0.00 after TA9_FILTER_DISTANCE_TO_HARDSTOP_NONNEG (TA9 raw HTE kill was 70.00)
executable_net_effect_yen: 32830.00
TA5_advantage_or_disadvantage_yen: 12767.00
TA4_advantage_or_disadvantage_yen: 18827.00
additional_logging_required: yes; runtime candidate logs must include distance_to_hardstop_yen, hte state, priority_snapshot_id, eval_stage_index, and same-tick ClosePriority state
next_action: Design-review TA9 safe filter in POST_HEDGE_SLOT. If priority-order change is not accepted, move to TA5 as safer fallback.

Reference raw plan comparison:
- TA9 raw net: 32760.00; HTE Kill 1 / 70.00 yen.
- TA5 net: 20063.00; HTE Kill 0.
- TA4 net: 14003.00; HTE Kill 0.


===== timing_alignment_ta9_hte_kill_trace.txt =====
TA9 HTE Kill trace
- basket_uid: GOLD#2026.04.24T20:21:05#200#HEDGED#2
- source_log: C:\Users\user\Documents\New project\KOUCHA_GOLD_S2_PRE_HARDSTOP_P1_COMPARE\P0_BASELINE_50K_MAR_MAY_M1_20260301_20260529\P0_BASELINE_50K_MAR_MAY_M1_20260301_20260529_trade_events.csv
- period/capital: 2026.03.01-2026.05.29 / 50000
- hedge_start_time: 2026.04.24 21:27:40
- TA9 first executable snapshot: 2026.04.27 01:02:00
- TA5 triggered: False at 
- TA4 triggered: False at 
- HTE close time: 2026.04.27 01:05:00
- HardStopPriority diagnostic time: 2026.04.27 01:02:00
- actual final reason/profit: HEDGED_BASKET_TIME_EXIT / -1752.00 yen
- TA9 virtual profit: -1822.00 yen
- lost recovery if TA9 first: 70.00 yen
- TA9 to HTE remaining minutes: 3.00
- priority at TA9 snapshot: HardStopNow=false, ClosePriorityOK=true, Reason=OK
- observed non-overfit safety clue: distance_to_hardstop_yen=-8.16 was negative while all TA9 HardStop rescue rows were non-negative.


===== timing_alignment_priority_slot_design.txt =====
Pre-HardStop Timing Alignment priority slot static design

Scope:
- No implementation was performed.
- This is a static design comparison using existing lifecycle/snapshot fields only.
- HardStopPriority-time back-calculation is diagnostic only and not used in conditions.

Option 1: Evaluate TA9 before existing HTE
- HardStop rescue: 26 baskets.
- HTE Kill risk: 1 basket / 70.00 yen.
- Existing close conflict: highest, because a TA9 POST_HEDGE_SLOT exit can preempt a later HTE success.
- priority_order_change_required: true.
- implementation complexity: high.
- fail-safe: requires explicit HardStopNow=false and ClosePriorityOK=true snapshot gate.
- unknown risk: same-tick HardStop/HTE sequencing and market-closed retry behavior.

Option 2: Evaluate TA9 after existing HTE, before HardStop
- HardStop rescue: may be close to TA9 if HTE is not currently eligible; exact effect needs runtime HTE eligibility snapshot.
- HTE Kill risk: lower than Option 1 if current HTE eligibility is checked before TA9.
- Existing close conflict: medium; HTE timing and acceptable-loss checks must be shared, not duplicated.
- priority_order_change_required: true.
- implementation complexity: high.
- fail-safe: safer than Option 1 but needs additional HTE eligibility trace at the same eval_stage.
- unknown risk: if HTE is not yet eligible but will be eligible minutes later, TA9 can still kill future HTE.

Option 3: POST_HEDGE_SLOT with HTE-near fallback to TA5 / distance safety
- HardStop rescue: TA9 original 26 baskets; TA5 baseline 20 baskets.
- HTE Kill risk: can be reduced to 0 with the best real-time filter found here: TA9_FILTER_DISTANCE_TO_HARDSTOP_NONNEG (distance_to_hardstop_yen >= 0).
- Filtered net effect: 32830.00 yen.
- Existing close conflict: medium; HTE/recovery/basketclose guard logs are mandatory.
- priority_order_change_required: true.
- implementation complexity: medium-high.
- fail-safe: best of the aggressive options if distance_to_hardstop_yen sign and HTE state are logged at runtime.
- unknown risk: distance_to_hardstop_yen < 0 while ClosePriorityOK=true is a same-tick edge and must be parity-logged before P1.

Option 4: Reject TA9 and evaluate TA5 only
- HardStop rescue: 20 baskets.
- HTE Kill risk: 0 / Recovery Kill 0 / BasketClose Kill 0.
- Net effect: 20063.00 yen versus TA9 original 32760.00 yen and TA4 14003.00 yen.
- Existing close conflict: lower than TA9, but still requires POST_HEDGE_SLOT and priority-order change.
- priority_order_change_required: true.
- implementation complexity: medium.
- fail-safe: highest among the non-zero candidates.
- unknown risk: effect is weaker and biased toward 50k logs.

Design conclusion:
- TA9 raw is not directly P1-ready because it kills one HTE success basket.
- TA9 can likely be made safer using a real-time field, distance_to_hardstop_yen >= 0, without losing observed HardStop rescues in the current six logs.
- Because this still requires POST_HEDGE_SLOT / priority-order change, the decision class remains TA9_DESIGN_REQUIRED, not immediate P1 implementation.
- If a simpler next P1 is required without resolving TA9 slot details, TA5 is the safer fallback.


===== timing_alignment_safe_filter_search.csv =====
condition_name,used_fields,condition,realtime_available,ta9_original_net_effect_yen,filtered_net_effect_yen,hardstop_rescue_count,hte_kill_count,recovery_kill_count,basketclose_kill_count,ta5_advantage_yen,ta4_advantage_yen,overfit_risk,additional_logging_required,reject_reason
TA9_FILTER_DISTANCE_TO_HARDSTOP_NONNEG,distance_to_hardstop_yen,distance_to_hardstop_yen >= 0,yes: fields are present in timing_alignment_plan_lifecycle at candidate snapshot,32760.00,32830.00,26,0,0,0,12767.00,18827.00,medium,distance_to_hardstop_yen sign must be logged at runtime candidate tick,
TA9_FILTER_DISTANCE_TO_HTE_LE_NEG500,distance_to_hte/hte_condition_distance,hte_condition_distance <= -500,yes: fields are present in timing_alignment_plan_lifecycle at candidate snapshot,32760.00,29196.00,21,0,0,0,9133.00,15193.00,medium-high,"no new field, but runtime parity logging still required",
TA9_FILTER_FLOATING_LE_NEG2500,floating_pnl_yen,floating_pnl_yen <= -2500,yes: fields are present in timing_alignment_plan_lifecycle at candidate snapshot,32760.00,26596.00,18,0,0,0,6533.00,12593.00,medium-high,"no new field, but runtime parity logging still required",
TA9_FILTER_FLOATING_LE_NEG3000,floating_pnl_yen,floating_pnl_yen <= -3000,yes: fields are present in timing_alignment_plan_lifecycle at candidate snapshot,32760.00,22095.00,13,0,0,0,2032.00,8092.00,high,"no new field, but runtime parity logging still required",
TA9_FILTER_DISTANCE_HS_0_TO_1500,distance_to_hardstop_yen,0 <= distance_to_hardstop_yen <= 1500,yes: fields are present in timing_alignment_plan_lifecycle at candidate snapshot,32760.00,20063.00,20,0,0,0,0.00,6060.00,medium-high,"no new field, but runtime parity logging still required",less attractive than TA5 or keeps HTE kill
TA9_FILTER_SPREAD_LE_070,spread_price,spread_price <= 0.70,yes: fields are present in timing_alignment_plan_lifecycle at candidate snapshot,32760.00,32830.00,26,0,0,0,12767.00,18827.00,medium,"no new field, but runtime parity logging still required",


===== timing_alignment_by_log_comparison.csv =====
plan_label,period,initial_deposit,eligible_snapshot_count,unique_basket_count,hardstop_rescue_count,executable_gross_effect_yen,kill_loss_or_opportunity_loss_yen,executable_net_effect_yen,maxdd_estimated_change_yen,hte_kill_count,recovery_kill_count,basketclose_kill_count,unresolved_count,total_effect_share
TA9,2026.03.01-2026.05.29,100000,5,5,5,9594.00,0.00,9594.00,2374.00,0,0,0,0,29.29%
TA5,2026.03.01-2026.05.29,100000,1,1,1,1544.00,0.00,1544.00,1544.00,0,0,0,0,7.70%
TA4,2026.03.01-2026.05.29,100000,0,0,0,0.00,0.00,0.00,0.00,0,0,0,0,0.00%
TA9,2026.03.01-2026.05.29,50000,9,9,8,6301.00,70.00,6231.00,922.00,1,0,0,0,19.02%
TA5,2026.03.01-2026.05.29,50000,8,8,8,6301.00,0.00,6301.00,922.00,0,0,0,0,31.41%
TA4,2026.03.01-2026.05.29,50000,8,8,8,6301.00,0.00,6301.00,922.00,0,0,0,0,45.00%
TA9,2026.04.01-2026.05.29,100000,4,4,3,4984.00,0.00,4984.00,1911.00,0,0,0,1,15.21%
TA5,2026.04.01-2026.05.29,100000,2,2,2,2996.00,0.00,2996.00,1602.00,0,0,0,0,14.93%
TA4,2026.04.01-2026.05.29,100000,0,0,0,0.00,0.00,0.00,0.00,0,0,0,0,0.00%
TA9,2026.04.01-2026.05.29,50000,7,7,7,6606.00,0.00,6606.00,1418.00,0,0,0,0,20.16%
TA5,2026.04.01-2026.05.29,50000,7,7,7,6606.00,0.00,6606.00,1418.00,0,0,0,0,32.93%
TA4,2026.04.01-2026.05.29,50000,7,7,7,6546.00,0.00,6546.00,1358.00,0,0,0,0,46.75%
TA9,2026.05.01-2026.05.29,100000,2,2,1,2729.00,0.00,2729.00,2356.00,0,0,0,1,8.33%
TA5,2026.05.01-2026.05.29,100000,0,0,0,0.00,0.00,0.00,0.00,0,0,0,0,0.00%
TA4,2026.05.01-2026.05.29,100000,0,0,0,0.00,0.00,0.00,0.00,0,0,0,0,0.00%
TA9,2026.05.01-2026.05.29,50000,3,3,2,2616.00,0.00,2616.00,1305.00,0,0,0,1,7.99%
TA5,2026.05.01-2026.05.29,50000,3,3,2,2616.00,0.00,2616.00,1305.00,0,0,0,1,13.04%
TA4,2026.05.01-2026.05.29,50000,1,1,1,1156.00,0.00,1156.00,1156.00,0,0,0,0,8.26%


===== timing_alignment_leave_one_log_out.csv =====
avg_net_effect_yen,excluded_initial_deposit,excluded_period,full_net_effect_yen,max_net_effect_yen,min_net_effect_yen,plan_label,rank_after_exclusion,ranking,remaining_net_effect_yen,sign_reversal,sign_reversal_any,ta5_below_ta4,ta5_below_ta4_cases,ta9_below_ta5,ta9_below_ta5_cases
,100000,2026.03.01-2026.05.29,32760.00,,,TA9,1,TA9 > TA5 > TA4,23166.00,False,,False,,False,
,100000,2026.03.01-2026.05.29,20063.00,,,TA5,2,TA9 > TA5 > TA4,18519.00,False,,False,,False,
,100000,2026.03.01-2026.05.29,14003.00,,,TA4,3,TA9 > TA5 > TA4,14003.00,False,,False,,False,
,50000,2026.03.01-2026.05.29,32760.00,,,TA9,1,TA9 > TA5 > TA4,26529.00,False,,False,,False,
,50000,2026.03.01-2026.05.29,20063.00,,,TA5,2,TA9 > TA5 > TA4,13762.00,False,,False,,False,
,50000,2026.03.01-2026.05.29,14003.00,,,TA4,3,TA9 > TA5 > TA4,7702.00,False,,False,,False,
,100000,2026.04.01-2026.05.29,32760.00,,,TA9,1,TA9 > TA5 > TA4,27776.00,False,,False,,False,
,100000,2026.04.01-2026.05.29,20063.00,,,TA5,2,TA9 > TA5 > TA4,17067.00,False,,False,,False,
,100000,2026.04.01-2026.05.29,14003.00,,,TA4,3,TA9 > TA5 > TA4,14003.00,False,,False,,False,
,50000,2026.04.01-2026.05.29,32760.00,,,TA9,1,TA9 > TA5 > TA4,26154.00,False,,False,,False,
,50000,2026.04.01-2026.05.29,20063.00,,,TA5,2,TA9 > TA5 > TA4,13457.00,False,,False,,False,
,50000,2026.04.01-2026.05.29,14003.00,,,TA4,3,TA9 > TA5 > TA4,7457.00,False,,False,,False,
,100000,2026.05.01-2026.05.29,32760.00,,,TA9,1,TA9 > TA5 > TA4,30031.00,False,,False,,False,
,100000,2026.05.01-2026.05.29,20063.00,,,TA5,2,TA9 > TA5 > TA4,20063.00,False,,False,,False,
,100000,2026.05.01-2026.05.29,14003.00,,,TA4,3,TA9 > TA5 > TA4,14003.00,False,,False,,False,
,50000,2026.05.01-2026.05.29,32760.00,,,TA9,1,TA9 > TA5 > TA4,30144.00,False,,False,,False,
,50000,2026.05.01-2026.05.29,20063.00,,,TA5,2,TA9 > TA5 > TA4,17447.00,False,,False,,False,
,50000,2026.05.01-2026.05.29,14003.00,,,TA4,3,TA9 > TA5 > TA4,12847.00,False,,False,,False,
27300.00,,,,30144.00,23166.00,TA9,,,,,False,,0,,0
16719.17,,,,20063.00,13457.00,TA5,,,,,False,,0,,0
11669.17,,,,14003.00,7457.00,TA4,,,,,False,,0,,0


===== result_summary.txt =====
Result summary

Conclusion: TA9 has the best raw and safety-adjusted effect, but direct P1 implementation is not allowed from this audit.
selected_plan: TA9_SAFE_DISTANCE_TO_HARDSTOP_NONNEG
decision_class: TA9_DESIGN_REQUIRED
P1_implementation_allowed: false
TA9 raw executable_net_effect_yen: 32760.00
TA9 safe-filter executable_net_effect_yen: 32830.00
TA5 executable_net_effect_yen: 20063.00
TA4 executable_net_effect_yen: 14003.00
No EA/trading/close logic was changed. Outputs are analysis artifacts only.


===== next_decision.txt =====
Next decision

Do not start P1 implementation directly from this package.
Next action: human/design approval for TA9_SAFE_DISTANCE_TO_HARDSTOP_NONNEG in a POST_HEDGE_SLOT or equivalent pre-HardStop evaluation slot.
If priority-order change is not acceptable, TA5_DISTANCE_HS_1500_HTE_NOT_NEAR is the safer P1 fallback.
TA4 remains the conservative fallback but is weaker and 50k-biased in this six-log sample.


===== calculation_self_audit.txt =====
Calculation self audit

Compile: OK, reused existing compile result from input package (True).
EA source diff: zero edits in this audit; analysis script and outputs only.
Trading/close logic diff: zero.
set diff: none generated or modified.
Aggregation formula: OK.
Sign check: OK.
Basket deduplication: OK, one candidate per plan/period/deposit/basket_uid asserted.
basket_uid matching: OK for lifecycle rows; TA9 HTE trace matched runtime event log by BasketUid.
HardStopNow/ClosePriority gating: OK, adopted rows limited to HardStopNow=false and ClosePriorityOK=true.
Future information in conditions: OK; safe filters use candidate snapshot fields only.
HardStopPriority reverse-time labels: diagnostic only, not used as conditions.
RECOVERY_CLOSE/BASKET_CLOSE sample size: 0, so Kill 0 is not generalized beyond this sample.
Input ZIP SHA256: 01574CC3481878A15B11B54ECC866E8618C33E9715D36AA22E8B1F6058F037D4
