#!/bin/bash
# [2026-10-03] robustness of exit_v2 smooth_arm 0.7 (live from 10/5): neighbours on v2's fixed entries, 24 days
cd /var/www/screener/trade
L=/var/www/screener/trade/reports/arm_sweep_1003.log
T=/var/www/screener/trade/reports/open_window/tick20
S=/var/www/screener/trade/data/simulations
BASE="--max-positions 99 --entry-v2 --exit-v2 --xv2-set trail=false --xv2-set climax_exit=true"
for v in a060 a065 a075 a070b055 a070b050 a070b065; do
  case $v in a060) X="--xv2-set smooth_arm=0.6 --xv2-set smooth_break=0.5";; a065) X="--xv2-set smooth_arm=0.65";;
             a075) X="--xv2-set smooth_arm=0.75";; a070b055) X="--xv2-set smooth_arm=0.7 --xv2-set smooth_break=0.55";;
             a070b050) X="--xv2-set smooth_arm=0.7 --xv2-set smooth_break=0.5";; a070b065) X="--xv2-set smooth_arm=0.7 --xv2-set smooth_break=0.65";; esac
  for d in $(ls $T/cands/ | sed 's/.json//' | awk '$1>="2026-08-27" && $1<="2026-09-30"' | sort); do
    if [ $d = 2026-09-30 ]; then F=$S/live_2026-09-30_fixed.json; C=/tmp/claude-0/-var-www-screener-trade/5844eef7-c648-46de-a03c-fe0b1434b640/scratchpad/cands_0930_live.json
    else F=$S/${d}_sim_maxpos99_gr_r25_es0p_rs45_reabove_entry_v2_cf.json; C=$T/cands/$d.json; fi
    G=""; [ $d = 2026-09-22 ] && G="--synthetic-grid"
    nice -n 5 python3 simulate.py --date $d $BASE $X $G --fixed-entries $F --candidates-file $C > $T/out/arm1003_${v}_$d.out 2>&1
    echo "exit $v $d $(grep 'total:' $T/out/arm1003_${v}_$d.out)" >> $L
  done
done
echo ALLDONE >> $L
