Commit Graph

11 Commits

Author SHA1 Message Date
c53dff6d9f Fix weekend gap risk and short signal detection
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
2026-03-29 23:46:01 -04:00
2a8ef3f0d2 Fix HIGH/LOW input variable scope - use InpManualHigh/Low for inputs and GridHigh/Low for runtime 2026-03-29 22:32:29 -04:00
3971dbd2b3 Rename HIGH/LOW to InpHigh/InpLow to avoid MQL5 constant conflict 2026-03-29 22:28:14 -04:00
16b69d251c Fix warningPrinted scope - restructure CheckDailyDrawdown function 2026-03-29 22:27:13 -04:00
04756ef2bd Fix warningPrinted scope error - move declaration to function level 2026-03-29 22:23:35 -04:00
15cd0153e3 Add order cancellation logic to OrdersEA_Smart_Grid
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
2026-03-24 21:53:44 -04:00
b5df20d054 Fix invalid price errors - add stop level validation 2026-03-24 15:35:12 -04:00
2bdaee0fe5 Fix missing input declarations in OrdersEA_Smart_Grid
Added missing input variables:
- input int EquityFactorPercent= 0;
- input int LotsFactorPercent= 0;

These were referenced in CalcLots() function but not declared.
2026-03-24 15:02:01 -04:00
0a26f3469f Fix type conversion errors in OrdersEA_Smart_Grid
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.
2026-03-24 15:00:08 -04:00
a74b5db8f7 Fix MT5 array declaration issues in OrdersEA_Smart_Grid
Changed dynamic arrays to fixed-size arrays:
- MqlRates rates[] -> rates[1]
- double rsiBuf[] -> rsiBuf[1]
- double adxBuf[] -> adxBuf[1]
- double atrBuf[] -> atrBuf[1]
- Removed ArraySetAsSeries calls (not needed for fixed arrays)

This fixes common 'array out of range' errors in MT5.
2026-03-24 14:52:42 -04:00
f0b8653420 Add complete MT5 conversion of OrdersEA_Smart_Grid
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
2026-03-24 14:35:38 -04:00