PROTECTION V2 UPDATE

Upload this package into the existing TradingLab folder, retaining its lib/ and assets/ folders and overwriting the included files. Briefly disable only TradingLab's cron during replacement, then re-enable the SAME once-per-minute cron. Minimize this interruption because open positions are not monitored while cron is disabled. Do not reset or reimport the database. No credentials or config.php are included.

worker.php remains the sole cron entry. It launches scanner.php automatically through PHP proc_open, using the same PHP executable. The worker owns all trade fills, exits, funding settlement and accounting. The scanner only reads candles, proposes entries and fetches funding history. It cannot close positions. Both have separate process locks. A protection heartbeat lease prevents an orphan scanner from continuing after the protector stops reporting.

Expected dashboard: Protection: DEDICATED_SCANNER. If it shows PROTECTION_ONLY or SCANNER_STOPPED, check the scanner error shown there. PHP proc_open may be disabled by your hosting configuration. Existing positions remain managed, but fresh signals require the scanner to run. No new daemon, service installation or second cron is required.

Due exits run before quote/mark downloads. Each market's positions are checked as soon as its quotes arrive, and newly triggered exits wait their minimum delay rather than waiting through another research cycle. At most one new entry attempt is made per protection pass. Funding HTTP downloads occur in the scanner; settlement remains in the protector. Quote and depth HTTP calls still take time. Rate limits, network failures, price jumps, serial exit fills and the gap between cron invocations can still cause losses beyond a stop price. This is REST polling, not an exchange-native stop or WebSocket service. A half-second idle target is not a guaranteed half-second price refresh.

Symbols that cannot meet minimum quantity/notional at the saved position budget are excluded from candidates and checked again at entry. Existing open positions remain monitored even when their symbol is excluded from new entries.

Existing run history, balances, and position stop/target/holding rules are retained. The authorized execution upgrade accepts the immediately preceding known releases only, with identical experiment settings. An EXECUTION_UPGRADE event and protection-v2 entry/exit evidence mark the execution change. Compare pre/post-upgrade periods separately; do not interpret them as one unchanged execution experiment. Arbitrary other code/settings changes still block entries.

Entry thresholds and cooldowns are deliberately unchanged in this execution update. They require separate future strategy variants so execution and signal changes are not confounded.

Export data now includes scanner.php, protection status, exclusion diagnostics and execution timing evidence. Send a new full export after the updated system has accumulated trades to measure the actual latency improvement.

Local validation: original 41 regression checks, 19 protection/process/funding checks, export tests, PHP/JavaScript syntax checks, and dashboard rendering smoke test. Production VPS timing and process permissions are not verified locally.
