#!/bin/bash
# [2026-09-28] setup J with the extension rule anchored to VWAP (2%) instead of the open -- same 20 days
# and settings as run_tick20.sh "base" (which had J at 9 trades, +$21.46). Waits for trade1's buy-volume run.
while ps -eo cmd | grep -q "^python3 simulate.py --days all --rules-dir sim/rules"; do sleep 60; done
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 --ext-anchor vwap --ext-vwap-base 2.0"
for f in $T/cands/*.json; do
  d=$(basename $f .json); G=""; [ $d = 2026-09-22 ] && G="--synthetic-grid"
  nice -n 10 python3 simulate.py --date $d $J $G --candidates-file $f > $T/out/anchorvwap_$d.out 2>&1
  echo "anchorvwap $d $(grep 'total:' $T/out/anchorvwap_$d.out)"
done
echo ANCHOR_DONE
