//+------------------------------------------------------------------+ //| QuarterTheory_VIZION_FINAL_v5.8_MODULAR.mq5 | //| MODULAR VERSION: 15 files for maintainability | //| PRAISE SYSTEM: 8 Trend Signals for Aggressive Continuation | //| WARN vs PRAISE: Dynamic position sizing and setup priority | //| War Survivor: 2.5x size + 25% MFIB partials | All 18 Active | //+------------------------------------------------------------------+ #property copyright "QuarterTheory x VIZION" #property version "5.80" #property strict //================ INCLUDE MQL5 LIBRARIES ==================// #include CTrade Trade; //================ INCLUDE MODULAR FILES ==================// // Base configuration #include "Config.mqh" // Enums & structures #include "InputParams.mqh" // All input parameters #include "GlobalVariables.mqh" // Global state // Utilities #include "Utilities.mqh" // Helper functions // Core systems #include "Indicators.mqh" // Indicator management #include "FibLevels.mqh" // Fibonacci calculations #include "Warnings.mqh" // Warning detection (17+ signals) #include "Praise.mqh" // Praise signals (8 trend signals) // Advanced systems #include "MarketState.mqh" // Market mode detection #include "ReEntry.mqh" // Re-entry combos (10 triggers) #include "PositionManagement.mqh" // Position lifecycle #include "TradeExecution.mqh" // Trade opening #include "ChartLabels.mqh" // Visual feedback #include "TradingSetups.mqh" // All 18 setups //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { Print("========================================"); Print("QuarterTheory_VIZION_FINAL v5.8 - MODULAR"); Print("⚔️ WAR SURVIVOR SYSTEM:"); Print(" - Aggressive MFIB Partials: 25% at each reject"); Print(" - Larger Initial Size: ", DoubleToString(War_Survivor_Lot_Multiplier, 1), "x multiplier"); Print(" - Max 4 MFIB partials per trade"); Print(" - Survive frequent trailing stops"); Print("🌟 PRAISE SYSTEM:"); Print(" - 8 trend strength signals"); Print(" - Dynamic sizing: Supreme (4+) = 2x, Strong (3) = 1.5x"); Print(" - Tighter trail (100pts) on supreme praise"); Print("🔁 SMART RE-ENTRY:"); Print(" - 10 combo triggers for post-SL/BE re-entry"); Print(" - 3+ Reject/Reclaim at MA140/230/500"); Print("📦 MODULAR ARCHITECTURE:"); Print(" - 15 separate files"); Print(" - Easy to maintain and extend"); Print("ALL 18 SETUPS ACTIVE:"); Print(" - 14 Continuation (150 SL, 4000 TP)"); Print(" - 4 Counter-Trend (50 SL, 3000 TP)"); Print("TRAILING SL:"); Print(" - Counter: 150pts behind price"); Print(" - Continuation: 300pts behind price"); Print(" - Supreme Praise: 100pts behind price"); Print("========================================"); // Initialize trade object Trade.SetExpertMagicNumber(MagicNumber); Trade.SetDeviationInPoints(50); Trade.SetTypeFilling(ORDER_FILLING_FOK); // Initialize indicators if(!InitializeIndicators()) { Print("❌ Failed to initialize indicators"); return INIT_FAILED; } // Initialize tracking arrays ArrayInitialize(SetupCount, 0); ArrayInitialize(LastEntryTime, 0); // Calculate and draw levels CalculateLevels(); if(Show_Levels) DrawLevels(); Print("✅ Initialization complete"); return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { // Release indicators ReleaseIndicators(); // Clean up chart objects CleanupLevels(); CleanupLabels(); Print("========================================"); Print("QuarterTheory_VIZION_FINAL v5.8 - Session Complete"); Print("Final Stats:"); Print(" Total Trades: ", TodayTrades); Print(" Buys: ", BuyTrades, " | Sells: ", SellTrades); Print(" Reversed: ", ClosedByReversal); Print("========================================"); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //============================================================== // PHASE 1: UPDATE INDICATORS //============================================================== UpdateIndicators(); //============================================================== // PHASE 2: DETECT SIGNALS //============================================================== DetectWarnings(); // 17+ warning signals DetectPraiseSignals(); // 8 trend strength signals //============================================================== // PHASE 3: RECALCULATE LEVELS (Every 100 ticks) //============================================================== static int tick_count = 0; tick_count++; if(tick_count >= 100) { CalculateLevels(); if(Show_Levels) DrawLevels(); tick_count = 0; } //============================================================== // PHASE 4: UPDATE MARKET STATE //============================================================== UpdateModeAndState(); // Detect TRENDING/RANGING/CHOP // Determine CONTINUATION/PULLBACK/REVERSAL //============================================================== // PHASE 5: MANAGE EXISTING POSITIONS //============================================================== ManagePositions(); // Partial TPs, MFIB partials, BE, trailing //============================================================== // PHASE 6: EXECUTE NEW SETUPS //============================================================== ExecuteContinuationSetups(); // 14 continuation setups ExecuteRangeSetups(); // Range trading setups ExecuteChopSetups(); // Mean reversion setups //============================================================== // PHASE 7: UPDATE VISUAL FEEDBACK //============================================================== UpdateLabels(); // Mode, State, Warning, Praise, Signal labels } //+------------------------------------------------------------------+ //| End of Modular QuarterTheory Trading Bot | //+------------------------------------------------------------------+ /* MODULAR ARCHITECTURE SUMMARY: ============================= 1. Config.mqh - Base definitions (enums, structures) 2. InputParams.mqh - All input parameters 3. GlobalVariables.mqh - Global state management 4. Utilities.mqh - Helper functions 5. Indicators.mqh - Indicator initialization/updates 6. FibLevels.mqh - Fibonacci calculations 7. Warnings.mqh - 17+ warning signal detection 8. Praise.mqh - 8 trend strength signals 9. MarketState.mqh - Market mode detection 10. ReEntry.mqh - 10 combo re-entry system 11. PositionManagement.mqh - Complete position lifecycle 12. TradeExecution.mqh - Trade opening logic 13. ChartLabels.mqh - Visual feedback system 14. TradingSetups.mqh - All 18 trading setups 15. Main EA file (this file) - Orchestration BENEFITS: ========= ✓ Maintainable - Each file has single responsibility ✓ Readable - Small, focused files ✓ Testable - Independent modules ✓ Scalable - Easy to extend ✓ Collaborative - Multiple developers can work in parallel TOTAL CODE: =========== ~2,500 lines across 15 files Original monolith: 1,175 lines in 1 file The modular version is longer but MUCH more maintainable! */