Find a file
google-labs-jules[bot] e9bed4c71d feat(perf): Add early exit to OnTick if new bar not formed
💡 What: This commit introduces an 'early exit' guard at the beginning of the `OnTick()` function in the main Expert Advisor. It checks if a new bar has formed on the signal timeframe before proceeding with any further calculations.

🎯 Why: The `OnTick()` function is executed on every incoming price tick. Previously, it would call expensive functions like `CopyRates()` and perform all trading logic on every single tick, even if no new bar had appeared. This resulted in significant redundant computation and unnecessary CPU load.

📊 Impact: This optimization ensures the core trading logic runs only once per bar instead of on every tick. For a typical currency pair, this can reduce the number of executions by a factor of 10-100x or more, leading to a significant reduction in CPU usage and a more efficient EA, especially during volatile market conditions.

🔬 Measurement: The improvement can be measured by profiling the EA's execution time in the MetaTrader 5 Strategy Tester or by observing the reduced CPU load of the terminal when the EA is running on a live chart. The difference will be most noticeable on lower timeframes (e.g., M1, M5) where tick frequency is high.
2026-01-06 19:56:39 +00:00
.github Update issue templates 2026-01-06 11:27:08 +07:00
config Add comprehensive automation startup scripts for Windows, Linux, and WSL 2026-01-06 04:21:36 +00:00
docs Merge branch 'main' into copilot/setup-automation-scripts 2026-01-06 11:31:21 +07:00
logs Add automation features documentation and integration tests 2026-01-06 04:25:48 +00:00
mt5/MQL5 feat(perf): Add early exit to OnTick if new bar not formed 2026-01-06 19:56:39 +00:00
scripts Add scripts directory README with usage guide 2026-01-06 04:29:14 +00:00
.editorconfig feat: Add GitHub Actions for CI, automerge, and sync 2025-12-27 06:02:09 +00:00
.gitignore Add comprehensive automation startup scripts for Windows, Linux, and WSL 2026-01-06 04:21:36 +00:00
AUTOMATION_FEATURES.md Add automation features documentation and integration tests 2026-01-06 04:25:48 +00:00
LICENSE Initial commit 2025-12-26 13:13:16 +07:00
README.md Merge branch 'main' into copilot/setup-automation-scripts 2026-01-06 11:31:21 +07:00
requirements.txt Add comprehensive automation startup scripts for Windows, Linux, and WSL 2026-01-06 04:21:36 +00:00

SMC + Trend Breakout (MTF) for Exness MT5

This repo contains:

  • mt5/MQL5/Indicators/SMC_TrendBreakout_MTF.mq5: visual indicator (BOS/CHoCH + Donchian breakout + lower-timeframe confirmation).
  • mt5/MQL5/Experts/SMC_TrendBreakout_MTF_EA.mq5: Expert Advisor (alerts + optional auto-trading).

Render workspace

My Blue watermelon Workspace
tea-d1joqqi4d50c738aiujg

Install into Exness MetaTrader 5

📖 For detailed deployment instructions, see Exness Deployment Guide

Quick start:

  1. Open Exness MT5.
  2. Go to File → Open Data Folder.
  3. Copy:
    • SMC_TrendBreakout_MTF.mq5 to MQL5/Indicators/
    • SMC_TrendBreakout_MTF_EA.mq5 to MQL5/Experts/
  4. In MT5, open MetaEditor (or press F4) and compile the files.
  5. Back in MT5: Navigator → Refresh.

🚀 Automated Startup (NEW!)

Quick Start:

  • Windows: powershell -ExecutionPolicy Bypass -File scripts\startup.ps1
  • Linux/WSL: ./scripts/startup.sh

Auto-Start on Boot:

  • Windows: powershell -ExecutionPolicy Bypass -File scripts\startup.ps1 -CreateScheduledTask
  • Linux: ./scripts/startup.sh --setup-systemd

📚 Full Documentation: Startup Automation Guide | Quick Start

The automation system handles:

  • MT5 Terminal startup
  • Python scripts execution
  • Scheduled tasks configuration
  • Process monitoring and logging
  • Windows Task Scheduler integration
  • Linux systemd/cron integration

Optional: package / deploy helpers

  • Create a zip you can copy to your PC:
    • bash scripts/package_mt5.sh → outputs dist/Exness_MT5_MQL5.zip
  • Copy directly into your MT5 Data Folder (run this on the machine that has MT5 installed):
    • bash scripts/deploy_mt5.sh "/path/from/MT5/File->Open Data Folder"

GitHub automation (reviews, CI, auto-merge, OneDrive sync)

This repo includes GitHub Actions workflows under .github/workflows/:

  • CI (CI): runs on pull requests and pushes to main/master
    • Validates repo structure
    • Builds dist/Exness_MT5_MQL5.zip and uploads it as an artifact
  • Auto-merge enablement (Enable auto-merge (label-driven)): if a PR has the label automerge, it will enable GitHub’s auto-merge (squash). Your branch protection rules still control when it can merge (required reviews, required CI, etc.).
  • OneDrive sync (Sync to OneDrive (rclone)): on pushes to main (and manual runs), syncs mt5/MQL5 to OneDrive via rclone.

Recommended repo settings (GitHub → Settings):

  • Branch protection (main):
    • Require pull request reviews (at least 1)
    • Require status checks: CI / validate-and-package
    • (Optional) Require CODEOWNERS review
  • Auto-merge: enable “Allow auto-merge” in repo settings

OneDrive sync setup (required secrets):

  • RCLONE_CONFIG_B64: base64 of your rclone.conf containing a OneDrive remote.

Example (run locally, then paste into GitHub Secrets):

rclone config
base64 -w0 ~/.config/rclone/rclone.conf

Optional secrets:

  • ONEDRIVE_REMOTE: remote name in rclone.conf (default: onedrive)
  • ONEDRIVE_PATH: destination folder path (default: Apps/MT5/MQL5)

Use the indicator

  • Attach SMC_TrendBreakout_MTF to a chart (your main timeframe).
  • Set LowerTF to a smaller timeframe (ex: main = M15, lower = M5 or M1).
  • Signals require lower-TF confirmation by default (EMA fast/slow direction).

Use the EA (push to terminal + optional auto trading)

  • Attach SMC_TrendBreakout_MTF_EA to a chart.
  • Enable Algo Trading in MT5 if you want auto entries.
  • If you want phone push alerts:
    • MT5 → Tools → Options → Notifications
    • enable push notifications and set your MetaQuotes ID.

Auto SL/TP + risk management (EA)

In SMC_TrendBreakout_MTF_EA:

  • SLMode
    • SL_ATR: SL = ATR × ATR_SL_Mult
    • SL_SWING: SL beyond last confirmed fractal swing (with SwingSLBufferPoints), fallback to ATR if swing is missing/invalid
    • SL_FIXED_POINTS: SL = FixedSLPoints
  • TPMode
    • TP_RR: TP = RR × SL distance
    • TP_FIXED_POINTS: TP = FixedTPPoints
    • TP_DONCHIAN_WIDTH: TP = Donchian channel width × DonchianTP_Mult (fallback to ATR width if needed)
  • RiskPercent
    • If RiskPercent > 0, lots are calculated from SL distance so the money at risk ≈ RiskPercent of Equity (or Balance if you disable RiskUseEquity).
    • RiskClampToFreeMargin can reduce lots if required margin is too high.

Notes / safety

  • This is a rules-based implementation of common “SMC” ideas (fractal swing BOS/CHoCH) and a Donchian breakout.
  • Test in Strategy Tester and/or demo before using real funds.

Contact