My first EA with RSI + Stoch + MA
查找文件
SahrJohn 26ea936918
一些检测失败了
Build and Deploy MT5 EA / build (push) Failing after 3m21s
Build and Deploy MT5 EA / deploy (push) Has been skipped
2026-01-22 04:48:51 -06:00
.forgejo/workflows Update .forgejo/workflows/build.yaml 2026-01-20 08:29:09 +00:00
Ailabels.mqh Update Ailabels.mqh 2026-01-20 10:26:01 +00:00
Aisignalconfirmation.mqh Add Aisignalconfirmation.mqh 2026-01-20 20:08:21 +00:00
Candlepatterns.mqh Update Candlepatterns.mqh 2026-01-21 08:11:54 +00:00
Chartlabels.mqh Update Chartlabels.mqh 2026-01-20 10:15:22 +00:00
Chartstructure.mqh Add Chartstructure.mqh 2026-01-21 08:14:25 +00:00
config.mqh 2026-01-22 04:48:51 -06:00
Fiblevels.mqh Add Fiblevels.mqh 2026-01-20 07:45:13 +00:00
Globalvariables.mqh Update Globalvariables.mqh 2026-01-21 07:19:59 +00:00
Indicators.mqh Add Indicators.mqh 2026-01-20 07:44:03 +00:00
Inputparams.mqh 2026-01-22 04:48:51 -06:00
Marketstate.mqh 2026-01-22 04:48:51 -06:00
Masteraicoordinator.mqh 2026-01-22 04:48:51 -06:00
NeuralNet.mqh Update NeuralNet.mqh 2026-01-21 08:26:04 +00:00
NNDataLogger.mqh Add NNDataLogger.mqh 2026-01-21 09:23:11 +00:00
NNFeatures.mqh Update NNFeatures.mqh 2026-01-21 08:25:11 +00:00
Openai.mqh 2026-01-22 04:48:51 -06:00
Patterncoordinator.mqh Update Patterncoordinator.mqh 2026-01-21 08:33:11 +00:00
Patternsystemcomplete.mqh Add Patternsystemcomplete.mqh 2026-01-21 20:13:48 +00:00
Positionmanagement.mqh Add Positionmanagement.mqh 2026-01-20 07:49:18 +00:00
Praise.mqh Add Praise.mqh 2026-01-20 07:47:52 +00:00
profitmaxxingt.mq5 Update profitmaxxingt.mq5 2026-01-20 10:07:12 +00:00
profitmaxxingt1.mq5 2026-01-22 04:48:51 -06:00
profitmaxxingt2.mq5 Update profitmaxxingt2.mq5 2026-01-21 07:29:22 +00:00
profitmaxxingt3.1.mq5 2026-01-22 04:48:51 -06:00
profitmaxxingt3.mq5 Update profitmaxxingt3.mq5 2026-01-21 07:46:09 +00:00
python_server.py Add python_server.py 2026-01-21 09:28:14 +00:00
README.md Update README.md 2026-01-20 07:33:25 +00:00
Reentry.mqh Add Reentry.mqh 2026-01-20 08:09:18 +00:00
rt.txt Add rt.txt 2026-01-20 20:19:54 +00:00
Signalcoordinator.mqh Add Signalcoordinator.mqh 2026-01-20 20:07:29 +00:00
Tradeexecution.mqh 2026-01-22 04:48:51 -06:00
Tradingsetups.mqh Add Tradingsetups.mqh 2026-01-20 08:06:16 +00:00
Utilities.mqh Add Utilities.mqh 2026-01-20 07:42:59 +00:00
Warnings.mqh Add Warnings.mqh 2026-01-20 07:46:55 +00:00

QuarterTheory Trading Bot - Modular Refactoring

📦 Project Overview

This project refactors the monolithic QuarterTheory_VIZION_FINAL_v5.8.mq5 (1,175 lines) into a clean, modular architecture with 15 separate files for better maintainability, readability, and extensibility.


Completed Files (9/15)

Core Infrastructure

  1. Config.mqh - Base configuration, enums, and structures
  2. InputParams.mqh - All input parameters organized by groups
  3. GlobalVariables.mqh - Global state variables and arrays
  4. Utilities.mqh - Helper functions (price checks, conversions, etc.)

Systems

  1. Indicators.mqh - Indicator initialization and updates
  2. FibLevels.mqh - Fibonacci level calculation and drawing
  3. Warnings.mqh - Comprehensive warning detection (MA, Fib, MFIB, Stoch)
  4. Praise.mqh - 8 trend strength signals for aggressive trading
  5. PositionManagement.mqh - Complete position lifecycle management

📋 Remaining Files (6/15)

To Be Created

  1. MarketState.mqh - Market mode detection (TRENDING/RANGING/CHOP)
  2. ReEntry.mqh - Smart re-entry system with 10 combo triggers
  3. TradeExecution.mqh - Trade opening with dynamic lot sizing
  4. ChartLabels.mqh - Visual feedback system
  5. TradingSetups.mqh - All 18 trading setups execution
  6. Main EA File - Orchestrates all modules

🏗️ Architecture

Config.mqh (base definitions)
    ↓
GlobalVariables.mqh
    ↓
InputParams.mqh
    ↓
Utilities.mqh
    ↓
├─ Indicators.mqh
├─ FibLevels.mqh
├─ Warnings.mqh
├─ Praise.mqh
├─ MarketState.mqh (to create)
├─ ReEntry.mqh (to create)
├─ PositionManagement.mqh
├─ TradeExecution.mqh (to create)
├─ ChartLabels.mqh (to create)
└─ TradingSetups.mqh (to create)
    ↓
Main EA File (to create)

🔑 Key Features

War Survivor System

  • 2.5x lot multiplier for larger initial positions
  • 25% MFIB partials at each rejection level
  • Maximum 4 MFIB partials per trade
  • Designed to survive frequent trailing stops

Praise System (8 Signals)

  1. Triple Magnet - MA7×14×21 tight hold
  2. Power Couple - MA14×21 close alignment
  3. MFIB Staircase - Sequential level advance
  4. MFIB Express - Skip MFIB levels
  5. MFIB Breakout - Level break + hold
  6. MA Stack - Perfect MA alignment
  7. Clean Reclaim - MFIB+MA+Fib together
  8. Multi-Breakout - Everything breaks at once

Warning System (17+ Signals)

  • Stochastic extremes and crosses
  • MA cross warnings (7×14, 7×21, 7×50)
  • Fibonacci reject/reclaim/break
  • MFIB reject/reclaim/break
  • MA reject/reclaim/break
  • Band snap detection
  • Pullback/retracement confluence

Re-Entry System (10 Combos)

  • 3+ Reject/Reclaim at strong MAs
  • MA14 Magnet + Fib/MFIB break
  • Strong MA bounce + Stoch confirm
  • Trend resumption post-pullback
  • Level reclaim + MA alignment
  • Band snap recovery
  • Triple level confluence
  • Stoch extreme + level
  • MA cross + level break
  • 4+ warning confluence

📊 Trading Setups

Continuation (14 setups - 150 SL, 4000 TP)

  1. MA14 Cross
  2. MA50 Bounce
  3. MA140 Bounce
  4. MA230 Bounce
  5. MA500 Touch
  6. Fib Break
  7. Fib Reclaim
  8. Magnet Walk
  9. MFIB Ladder
  10. Staircase Advance
  11. Controlled Pullback
  12. Timeframe Reset
  13. MFIB Press
  14. [2 more in original]

Counter-Trend (4 setups - 50 SL, 3000 TP)

  1. Pullback Counter
  2. Retracement Counter
  3. Range Engine
  4. Mean Reversion

🎯 How to Use

Current State

The project includes 9 working .mqh files that can be included in your main EA. See EXAMPLE_MAIN_FILE_STRUCTURE.mq5 for implementation pattern.

To Complete

  1. Review REFACTORING_GUIDE.txt for full specifications
  2. Create remaining 6 files by extracting code from original
  3. Test each module independently
  4. Integrate into main EA file
  5. Compile and backtest

💡 Benefits

Maintainability

  • Single Responsibility - Each file has one clear purpose
  • Easy Debugging - Find issues quickly in isolated modules
  • Clear Structure - Logical organization of related code

Readability

  • Self-Documenting - File names explain purpose
  • Small Files - Each under 500 lines (most under 300)
  • Focused Functions - Do one thing well

Testability

  • Unit Testing - Test each module independently
  • Mock Dependencies - Isolate components for testing
  • Debug Isolation - Issues contained to specific files

Scalability

  • Easy Extensions - Add setups in TradingSetups.mqh
  • New Signals - Extend Warnings.mqh or Praise.mqh
  • Feature Flags - Control systems via InputParams.mqh

Collaboration

  • Parallel Development - Multiple devs work on different files
  • Reduced Conflicts - Separate files minimize merge issues
  • Clear Ownership - Each file can have an owner

📁 File Contents

Config.mqh (163 lines)

  • MODE_FAMILY enum (4 types)
  • TREND_BIAS enum (3 states)
  • TREND_STRENGTH enum (3 levels)
  • PRICE_STATE enum (14 states)
  • SETUP_TYPE enum (18 setups)
  • TRADE_CATEGORY enum (2 types)
  • PositionRec structure (20 fields)
  • ClosedPositionRec structure (7 fields)

InputParams.mqh (106 lines)

  • Core settings (5 params)
  • Market mode system (4 params)
  • MA system (11 params)
  • Stochastic (7 params)
  • MFIB (2 params)
  • Fibonacci (2 params)
  • Continuation trades (6 params)
  • Counter-trend trades (6 params)
  • War Survivor (4 params)
  • Praise system (6 params)
  • Band snap (1 param)
  • Re-entry (2 params)

GlobalVariables.mqh (118 lines)

  • Indicator handles (13 handles)
  • Indicator values (arrays)
  • MA values (3 arrays × 10 MAs)
  • Price levels (7 static fib levels)
  • MFIB levels (5 levels + bias)
  • Stoch key levels (5 levels)
  • Market state (9 variables)
  • Warning flags (23 flags)
  • Re-entry flags (5 flags)
  • Praise flags (9 flags)
  • Position tracking (2 arrays)
  • Statistics (7 counters)

Utilities.mqh (187 lines)

  • MidPrice() - Calculate mid price
  • NearLevel() - Check proximity to level
  • StochCrossUp/Down() - Detect crosses
  • IsBullBias/IsBearBias() - Check bias
  • Bull_MA50_Reclaimed() - MA50 reclaim detection
  • Bear_MA50_Reclaimed() - MA50 reclaim detection
  • FamilyToText() - Convert enum to string
  • BiasToText() - Convert enum to string
  • StrengthToText() - Convert enum to string
  • StateToText() - Convert enum to string

Indicators.mqh (71 lines)

  • InitializeIndicators() - Create all handles
  • ReleaseIndicators() - Clean up handles
  • UpdateIndicators() - Update all values

FibLevels.mqh (136 lines)

  • CalculateLevels() - Calculate Fib + MFIB
  • DrawLevels() - Draw on chart
  • CleanupLevels() - Remove from chart

Warnings.mqh (352 lines)

  • DetectWarnings() - Comprehensive detection:
    • Stochastic analysis
    • MA cross analysis
    • Band snap detection
    • Fibonacci level analysis
    • MFIB level analysis
    • Strong MA analysis
    • Pullback confluence
    • Warning confluence count
    • Re-entry combo flags

Praise.mqh (298 lines)

  • DetectPraiseSignals() - 8 trend signals:
    • Triple Magnet (MA7×14×21)
    • Power Couple (MA14×21)
    • MFIB Staircase
    • MFIB Express
    • MFIB Breakout Hold
    • MA Stack Perfection
    • Clean Reclaim Sequence
    • Multi-Level Breakout

PositionManagement.mqh (179 lines)

  • RecordClosure() - Track closed positions
  • RecentlyStopped() - Check recent SL/BE hits
  • MarkRunners() - Identify runner positions
  • CloseOnFullReversal() - Reversal protection
  • ManagePositions() - Complete lifecycle:
    • Standard partial TPs
    • MFIB partials (War Survivor)
    • Breakeven management
    • Trailing stops
    • Closure tracking

🔧 Next Steps

Phase 1: Complete Core Files

  1. Create MarketState.mqh (extract from lines 601-735)
  2. Create ReEntry.mqh (extract from lines 343-486)
  3. Create TradeExecution.mqh (extract from lines 888-973)

Phase 2: UI & Setup Execution

  1. Create ChartLabels.mqh (extract from lines 736-887)
  2. Create TradingSetups.mqh (extract from OnTick lines 974-1167)

Phase 3: Final Integration

  1. Create Main EA File using EXAMPLE_MAIN_FILE_STRUCTURE.mq5 as template
  2. Test compilation
  3. Backtest each module
  4. Full system integration test

📝 Notes

  • All created files follow MQL5 conventions
  • Each file is independently testable
  • Clear dependency hierarchy prevents circular includes
  • War Survivor and Praise systems fully integrated
  • Re-entry combos ready for implementation
  • Original 18 setups preserved

📞 Support

For questions or issues:

  1. Review REFACTORING_GUIDE.txt for detailed specifications
  2. Check EXAMPLE_MAIN_FILE_STRUCTURE.mq5 for usage patterns
  3. Reference original file for complete logic

📄 License

Same as original QuarterTheory x VIZION project.


Version: 5.8 (Modular)
Status: 60% Complete (9/15 files)
Lines: ~1,600 lines across 9 files (vs 1,175 in original monolith)
Organization: