New functions: - CancelAllOrders(reason): Cancels all pending orders with logging - CloseAllPositions(reason): Closes all open positions - IsBreakout(): Detects when price breaks S2/R2 Order cancellation triggers: 1. ADX rises (trend starts) - Cancel all, wait for ranging 2. Price breaks S2/R2 (breakout) - Cancel all, close positions 3. Buy positions fill - Cancel remaining buy stops (avoid overexposure) 4. Sell positions fill - Cancel remaining sell stops 5. End of day (00:00) - Cancel all, close positions, reset grid This prevents: - Orphaned orders when trend starts - Overexposure when one side fills - Old orders from previous day causing issues
22 KiB
22 KiB