Grid EA (v3.1):
- Add weekend protection: close positions Friday before market close
- New settings: InpCloseBeforeWeekend, InpWeekendCloseHour, InpCancelPendingBeforeWeekend
- Prevents gap risk when market reopens Sunday/Monday
- FIX: Restore missing #include statements
Confluence EA (v1.14):
- Fix short signal detection by removing restrictive 'belowPivot' check
- Mirror BUY and SELL logic for symmetry
- Relax harmonic pattern tolerances (0.3-1.0 vs 0.5-0.8)
- Short signals now match buy signal generation
Add verify-short-signals.py to test short signal generation
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
Added missing input variables:
- input int EquityFactorPercent= 0;
- input int LotsFactorPercent= 0;
These were referenced in CalcLots() function but not declared.
Changed initEquity from int to double to fix:
- Line 217: double - int subtraction
- Line 226: int * double / double calculation
- Added explicit cast for BaseEquity assignment
This resolves implicit type conversion warnings/errors in MT5.
Full MQL4 to MQL5 conversion:
- Replaced OrderSend with CTrade::OrderSend
- Replaced MarketInfo with SymbolInfoDouble/Integer
- Replaced Bid/Ask/Digits/Point with SymbolInfoDouble
- Changed int ticket to ulong ticket
- Updated indicator handling (iRSI/iADX/iATR with CopyBuffer)
- Updated order placement to MqlTradeRequest/Result
- Added proper TRADE_ACTION_PENDING for stop orders
- Added OrderFillling_IOC compliance