MT5 Grid Optimizer & ATH Scanner – Pending Order Analyzer & Range Expansion Tool

July 16, 2026 • 12 min read • MT5 Tools, Grid Trading, Market Scanning, Pending Orders

Two Free MT5 Scripts — Download .ex5 Below

No email required • Drag-and-drop onto any chart • Source code from $30

Jump to Download

Most traders place pending orders based on gut feeling or round-number levels. The GridOptimizer and ATH Scanner are two professional-grade MT5 scripts that replace guesswork with data-driven analysis. Unlike Expert Advisors that trade automatically, these are analytical tools you run once on a chart to extract actionable intelligence from historical price data.

The GridOptimizer analyzes 90 days of H1 data to find the statistically optimal Buy Limit, Sell Limit, Buy Stop, or Sell Stop level for the current market. It considers market regime (trending vs ranging), swing point clusters, ATR-proportional stop/target distances, and simulates every possible entry across thousands of historical bars to score each level by weighted win rate.

The ATH Scanner is a 27-pair market scanner that detects when a pair is trading at a 90-day all-time-high while simultaneously experiencing its largest daily range in 90 days — a powerful confluence suggesting explosive directional momentum. Results are displayed instantly in the Experts tab and saved to a timestamped CSV file.

Tool Comparison

Feature GridOptimizer ATH Scanner
TypePending order level analyzerMulti-pair breakout scanner
ExecutionRun once per symbolRun once, scans 27 pairs
Core LogicRegime detection + swing analysis + ATR-based simulation90-day ATH + absolute max range confluence
Pairs Scanned1 (current chart symbol)27 major & cross pairs
Data Analyzed90 days H1 (2160+ bars)90 days D1 per pair
OutputBest entry level with confidence, WR%, R:R, chart drawingsMatching pairs list + CSV export
ATR UsageScan range, step size, min SL/TP, swing significanceNone (price-based)
Trend Alignment200 MA filter + regime penaltyN/A (breakout detection)
Confidence ScoringMulti-factor composite (8 variables)Binary (match / no match)
Best ForGrid traders, pending order strategistsBreakout traders, momentum scalpers
Download .ex5 GridOptimizer.ex5 ATH_Scanner.ex5

GridOptimizer — Optimal Pending Order Level Finder

How It Works

The GridOptimizer is the most comprehensive pending-order analysis tool available as a free MT5 script. It transforms 90 days of H1 price data into a single actionable recommendation: where to place your next Buy Limit, Sell Limit, Buy Stop, or Sell Stop — backed by statistical evidence.

Core Analysis Pipeline

📊

1. Regime Detection

Splits 90 days into 3 equal periods. If the price shift exceeds 1.5x ATR, the market is labeled trending; otherwise ranging. Trend-following orders get a 1.3x score bonus; counter-trend orders receive a 0.5x penalty.

🔍

2. Swing Point Detection

Identifies all significant swing highs and lows using 3-bar left/right confirmation. Duplicate swings within 0.4x ATR are merged (stronger one kept). Every entry level is validated against nearest swing for SL/TP placement.

🧪

3. Historical Simulation

Every potential entry level (stepped at 0.15x ATR intervals) is simulated across all historical bars. Each trigger is followed forward up to 168 bars. Recent data weighted 3x, mid-range 2x, old data 1x for a decay-weighted win rate.

The Scoring Formula

Score = WR² × R:R × TrendBonus × RegimePenalty × EntryReasonability × Consistency × ClusterBonus

Where:
WR = Decay-weighted win rate (recent 33% weighted 3x)
R:R = TP pips / SL pips (higher = better)
TrendBonus = 1.3 if aligned with 200 MA, 0.7 if against
RegimePenalty = 0.5 if counter-trend in trending market
EntryReasonability = 1.0 within 1.5x ATR, 0.6 within 2x ATR, 0.3 beyond
Consistency = 1.0 if 30+ triggers, 0.8 if 20+, 0.6 if 10+
ClusterBonus = Up to 1.5x based on swing cluster density near entry

Key Features

4 Order Types Analyzed

Buy Limit, Sell Limit, Buy Stop, Sell Stop — all four tested simultaneously. The best setup across all types is highlighted with a ★ marker.

Regime-Aware Analysis

Detects trending vs ranging regimes by comparing early, mid, and late 30-day price zones. Automatically penalizes counter-trend entries in trending markets.

Swing-Based SL/TP

Stop loss and take profit are always placed at the nearest confirmed swing point. If the swing distance is too small, it expands to the minimum ATR-based distance.

Decay-Weighted Win Rate

Recent 30 days weighted 3x, middle 30 days 2x, oldest 30 days 1x. Ensures the score reflects current market behavior more than ancient history.

Chart Drawing

Draws the best entry level (blue dashed), stop loss (red dashed), and take profit (green dashed) directly on the chart with pips labels and confidence tag.

Fully Configurable

All parameters are adjustable: lookback period, ATR scan range, step size, minimum triggers, max hold bars, SL/TP ATR multiples, trend MA period, and swing significance.

Input Parameters

ParameterDefaultDescription
InpLookbackDays90Historical data lookback period
InpTimeframePERIOD_H1Data timeframe for analysis
InpScanRangeATR2.5Max entry distance from current price in ATR
InpScanStepATR0.15Step between scan levels in ATR
InpMinTriggers10Minimum historical triggers required
InpMaxHoldBars168Max bars to wait for TP/SL after trigger
InpMinSL_ATR0.8Minimum stop loss distance in ATR
InpMinTP_ATR1.2Minimum take profit distance in ATR
InpTrendMAPeriod200MA period for trend alignment check
InpSwingMinATR0.4Minimum swing significance in ATR
InpDrawOnCharttrueDraw best entry levels on chart

How to Interpret Results

The script outputs a table comparing all four order types side by side. Look for HIGH confidence setups with at least 20 historical triggers and a win rate above 55%. A ★ next to the entry label on the chart indicates the highest-scored setup. If no setup meets minimum criteria, the script warns you and suggests parameter adjustments. Rerun on different symbols or after market shifts.

ATH Scanner — 90-Day All-Time-High Range Expansion Detector

How It Works

The ATH Scanner is a multi-pair scan script that screens 27 major and cross forex pairs for a specific high-probability breakout pattern: price trading at or near a 90-day all-time-high while simultaneously experiencing a daily range that exceeds every daily range in the past 90 days. This dual-confluence signals that momentum is breaking out in a statistically significant way.

Unlike oscillators or lagging indicators, the ATH Scanner is a pure price-action scanner that identifies when a pair is doing something it has not done in 90 days — both in terms of price level and volatility expansion. This is the type of setup institutional traders monitor for breakout continuation strategies.

27 Scanned Pairs

MajorsCrosses (EUR)Crosses (GBP)Crosses (JPY)Crosses (Other)
EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, NZDUSD, USDCADEURGBP, EURJPY, EURCHF, EURAUD, EURNZDGBPJPY, GBPCHF, GBPAUD, GBPNZD, GBPCADCHFJPY, AUDJPY, NZDJPY, CADJPYAUDNZD, AUDCAD, EURCAD, NZDCAD, AUDCHF, NZDCHF

Key Features

27-Pair Coverage

All major forex pairs plus key cross rates automatically scanned in a single run. Smart symbol resolution detects broker-specific suffixes (m, .pro, fx, etc.).

Dual Confluence Signal

Requires BOTH conditions: price at 90-day ATH (within 0.01% tolerance) AND today's range exceeding every daily range in the past 90 days.

CSV Export

All matching pairs are saved to a timestamped CSV file (e.g., ATH_Scan_2026_07_16.csv) with pair, ask, ATH, today range, max 90d range, expansion %, and ATH-to-low pips.

Detailed Console Output

Formatted output with pair numbering, ask price, ATH level, today range in pips, max 90d range, expansion percentage, and ATH-to-low pips. Non-matching pairs with errors are listed as skipped.

Input Parameters

ParameterDefaultDescription
InpPairs27 pairsComma-separated list of base pairs to scan
InpLookbackDays90Number of days for ATH and max range calculation

How to Trade ATH Scanner Results

When a pair appears in the scan results, it means price is at a 90-day high AND volatility is expanding beyond every other day in 90 days. This is a high-momentum breakout signal. Bullish approach: look for a pullback to the previous day's high (now support) for a limit entry. Bearish approach: a daily close below the ATH level suggests a false breakout — consider fading the move. Always combine with your broader market context (USD index, risk sentiment).

How to Use MT5 Scripts

These are scripts, not Expert Advisors. They run once and terminate. Here is how to use them:

  1. Download the .ex5 file(s) from the section below.
  2. Open your MT5 terminal and go to File → Open Data Folder → MQL5 → Scripts.
  3. Paste the .ex5 file(s) into the Scripts folder and restart MT5.
  4. For GridOptimizer: drag it onto your desired symbol's chart (H1 recommended). Review input parameters and click OK. Results appear in the Experts tab.
  5. For ATH Scanner: drag onto any chart (symbol doesn't matter — it scans 27 pairs automatically). Click OK. Results appear in the Experts tab and a CSV file is saved in the Files folder.

Script vs EA: Scripts do not loop or trade automatically. They analyze historical data, output results, and stop. Run them periodically (e.g., daily or after major economic events) to get fresh entry recommendations.

Free Download — MT5 .ex5 Scripts

Download the compiled scripts for free. No registration or email required. Simply download, install in your Scripts folder, and drag onto any chart.

GridOptimizer

Optimal pending order level finder

GridOptimizer.ex5

Size: ~25 KB | MT5 Script

ATH Scanner

27-pair 90-day ATH + range expansion

ATH_Scanner.ex5

Size: ~20 KB | MT5 Script

Source Code — Only $30

The free .ex5 files above are fully functional compiled scripts. For traders and developers who want to study, modify, or customize the logic, we offer the complete MQL5 source code:

  • GridOptimizer.mq5 — Full source with 720+ lines of documented MQL5 code including regime detection, swing analysis, and scoring engine.
  • ATH_Scanner.mq5 — Complete scanner source with smart symbol resolution and CSV export.
  • Both for $30 — Includes the right to modify for personal use.

To purchase: enquiry@algospecial.com or use our contact form. White-label rebranding and custom modifications also available.

2 Free Gold MT5 Expert Advisors RSI Pair Trader + EMA Rainbow Trend EA
Consecutive Candles Grid EA Free grid trading robot for MT5
MT5 Development Services Custom script & EA development
Live Economic Calendar Real-time forex news & analysis

Frequently Asked Questions

Are these Expert Advisors or Scripts?

They are MT5 scripts, not EAs. Scripts run once when dropped on a chart and then stop. They do not execute trades automatically. The GridOptimizer analyzes data and outputs a recommendation; the ATH Scanner scans 27 pairs and reports matches.

Can the GridOptimizer place orders for me?

No. It is an analytical tool only. It identifies the statistically optimal pending order level based on historical data. You must manually place the order. This design ensures you maintain full control over trade execution.

Do the ATH Scanner results guarantee a breakout?

No scanner guarantees a breakout. The ATH Scanner identifies when a pair is at a 90-day high with expanding range — a statistically significant confluence often seen at the start of major directional moves. Always use your own risk management and confirm with higher-timeframe context.

How often should I run the GridOptimizer?

Run it daily or after major economic events. The scoring changes as new price data enters the 90-day window and market regime shifts. Running it once per trading session gives you fresh, data-driven levels.

Why does the ATH Scanner report a symbol not found?

Different brokers use different symbol suffixes (e.g., EURUSDm, EURUSD.pro, EURUSD.fx). The script tries common suffixes automatically. If your broker uses an unusual suffix, add it to the supported suffixes list in the source code — available for $30.

Can I buy the source code for only one script?

Yes. Source code is $30 for both or $20 for individual scripts. Contact enquiry@algospecial.com for single-script pricing.

Make Data-Driven Trading Decisions

Stop guessing where to place your pending orders. Download the GridOptimizer and ATH Scanner free now.

Source code from $30. Contact us for custom modifications.