Files
conversation-history/2026-03-30-weekend-gap-short-signal-fix.md

139 lines
3.2 KiB
Markdown
Executable File

# Session: 2026-03-30 - Weekend Gap Fix & Short Signal Fix
## Participants
- **User**: Garfield (garfield@fetcherpay.com)
- **AI**: OpenCode CLI
## Session Overview
Fixed two known issues from previous session:
1. Weekend gap risk on Grid EA
2. Short signal detection on Confluence EA
---
## 1. Weekend Gap Risk Fix (Grid EA v3.1)
### Problem
Positions held over weekend can gap 100-500+ pips on Sunday/Monday open, causing massive losses.
### Solution Implemented
Added Friday position close feature:
```cpp
//--- Weekend Protection
input bool InpCloseBeforeWeekend = true; // Enable Friday close
input int InpWeekendCloseHour = 17; // Close at 5 PM broker time
input bool InpCancelPendingBeforeWeekend = true; // Cancel pending orders too
```
New `CheckWeekendProtection()` function closes all positions Friday before weekend.
### Files Modified
- `OrdersEA_Smart_Grid.mq5` - Added weekend protection (v3.1)
---
## 2. Short Signal Detection Fix (Confluence EA v1.14)
### Problem
EA was generating almost zero SHORT (SELL) trades. Historical data showed 0 shorts.
### Root Cause
Restrictive `belowPivot = close < p` check was blocking all short signals when price was above pivot point.
### Fix Applied
Removed asymmetric restriction - SELL logic now mirrors BUY logic:
**Before:**
```cpp
if(nearResistance || (rejectedFromResistance && belowPivot)) // ❌ Too restrictive
```
**After:**
```cpp
if(nearResistance || rejectedFromResistance) // ✅ Mirrors BUY
```
Also relaxed harmonic pattern tolerances from `0.5-0.8` to `0.3-1.3`.
### Files Modified
- `MultiSignal_Confluence_EA.mq5` - Fixed short signal detection (v1.14)
---
## 3. Compilation Errors Fixed
### Error 1: Missing #include
```
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
```
### Error 2: Undeclared identifiers
- `abovePivot` / `belowPivot` - removed from debug print
- `gridPlaced` - moved to global scope
---
## 4. Verification
### Short Signal Verification Script
Created `verify-short-signals.py` to validate short signal logic.
```bash
python3 verify-short-signals.py
```
Results: All checks passed ✅
---
## 5. File Deployment
### Files Copied to MT5
```
~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Experts/
├── MultiSignal_Confluence_EA.mq5 (v1.14)
└── OrdersEA_Smart_Grid.mq5 (v3.1)
```
### Next Step
- Recompile in MT5 MetaEditor (F7)
---
## 6. Git Commits
| Commit | Description |
|--------|-------------|
| `d071b3c` | Fix weekend gap risk and short signal detection |
| `c53dff6` | (amend) Restore missing #include statements |
| `028a41b` | Fix: remove abovePivot/belowPivot debug references |
| `24f3d09` | Fix: make gridPlaced global for CheckWeekendProtection |
---
## 7. Settings Files
Existing `.set` files work without modification - new parameters use sensible defaults:
- `InpCloseBeforeWeekend = true`
- `InpWeekendCloseHour = 17`
- `InpCancelPendingBeforeWeekend = true`
---
## 8. Next Steps
1. **Test in MT5** - Load both EAs on demo account
2. **Monitor** - Watch for SELL signals on Confluence EA
3. **Verify weekend close** - Check Grid EA closes Friday at 5 PM
4. **Push to Gitea** - Run `git push`
---
## Session Status: ✅ COMPLETE
---
*Session recorded: 2026-03-30*