From 02651535e6795ee9f1ac033b73cc322bff9a2a56 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sun, 15 Mar 2026 18:42:09 -0700 Subject: [PATCH] Fix: Block new trades if strategy has unresolved positions --- worker.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/worker.js b/worker.js index e405f4e..fa37797 100644 --- a/worker.js +++ b/worker.js @@ -72,6 +72,14 @@ async function main() { for (const strategy of strategies) { if (!strategy.enabled) continue; + // FIX: Prevent parallel betting! + // If the strategy has an unresolved position in limbo, it MUST wait. + // This protects the strict mathematical sequence of Martingale systems. + const acct = paper._getAccount(strategy.name); + if (acct.openPositions.size > 0) { + continue; + } + const signal = strategy.evaluate(state); if (signal) { console.log(`[Worker] Signal from ${strategy.name}: ${signal.side} @ ${signal.price}¢ — ${signal.reason}`);