#!/bin/bash
cd /var/www/screener/trade
T=/var/www/screener/trade/reports/open_window/tick20
J="--max-positions 99 --giveback-room-exit --giveback-room-min-cents 15 --giveback-room-ratio 0.25 --entry-slope-bars 0 --setup-plan --plan-context --plan-real-targets --min-stop-style k --min-stop-k 0.25 --resistance-stall-exit --max-ext-open --plan-min-rr 2.0 --synthetic-grid"
d=2026-09-22; f=$T/cands/$d.json
for v in base gate gate15; do
  case $v in base) X="";; gate) X="--shadow-gate pass";; gate15) X="--shadow-gate pass --shadow-gate-block-minutes 15";; esac
  nice -n 10 python3 simulate.py --date $d $J --candidates-file $f --shadow-log $T/shadow_$v $X > $T/out/${v}_$d.out 2>&1
  echo "$v $d $(grep 'total:' $T/out/${v}_$d.out)"
done
echo RERUN_DONE
