MT4 Multi-Pair Stochastic & Moving Average Scanner v1.03

Advance_Quants

Administrator
Staff member

MT4 Multi-Pair Stochastic & Moving Average Scanner v1.03​

Market Watch Scanner for Currencies, Metals, Energies, CFD, Crypto, Commodities, Stocks​

A Comprehensive Guide to the Stochastic MA Scanner v1.03 for MT4​

The Stochastic MA Scanner v1.03 is a powerful custom indicator for MetaTrader 4 (MT4), designed to help traders identify high-probability trading opportunities across multiple symbols. Built by Advance Quants, this scanner combines Stochastic oscillator signals with an optional Moving Average (MA) trend filter, providing a robust tool for technical analysis. This article provides a detailed guide to understanding, installing, and using the scanner effectively.

MT4 Multi-Pair Stochastic & Moving Average Scanner v1.01


Set Default template with Stochastic & MA

Signal Logic​

The Stochastic MA Scanner v1.03 generates Buy and Sell signals based on a combination of Stochastic oscillator crossovers and an optional MA trend filter.
Here’s how the signal logic works:
  • Stochastic Signal:​

    • Buy Signal: The Stochastic main line (%K) crosses above the signal line (%D) while the main line is in the oversold region (below 30.0). Additionally, the difference between %K and %D must exceed a minimum threshold (default: 5.0) to ensure a strong crossover.
    • Sell Signal: The Stochastic main line (%K) crosses below the signal line (%D) while the main line is in the overbought region (above 70.0), with the same minimum difference requirement.
  • Optional MA Trend Filter:​

    • If enabled, the scanner uses a 10-bar linear regression slope of a Moving Average (default: 50-period SMA on close price) to determine the trend direction.
    • For a Buy signal to be valid, the MA slope must be positive (indicating an uptrend) and greater than a minimum slope threshold (default: 0.1 points per bar).
    • For a Sell signal to be valid, the MA slope must be negative (indicating a downtrend) and less than the negative of the minimum slope threshold (default: -0.1 points per bar).
  • Alert Trigger:​

  • A signal is only triggered if both the Stochastic condition and the MA trend filter (if enabled) are satisfied. Alerts are throttled to prevent repetition within a user-defined interval (default: 30 minutes).

This dual-filter approach ensures that signals align with both momentum (via Stochastic) and trend direction (via MA slope), reducing false positives in choppy markets.​


Overview​

The Stochastic MA Scanner v1.03 is an MT4 indicator designed to scan multiple symbols for trading opportunities based on Stochastic oscillator signals, with an optional trend filter to enhance signal reliability. It is particularly useful for traders who monitor several markets simultaneously, such as forex pairs, indices, or commodities. The scanner runs on a single chart but can monitor a user-defined list of symbols or all symbols in the Market Watch window. It features a customizable dashboard, multiple alert options, and interactive chart-opening functionality, making it a versatile tool for both novice and experienced traders.

Key Features​

1. Stochastic Signal Detection​

The scanner uses the Stochastic oscillator to detect momentum-based trading opportunities:
  • Configurable Parameters: Adjust the %K period (default: 5), %D period (default: 3), slowing (default: 3), MA method (default: LWMA), and price field (default: Low/High).
  • Overbought/Oversold Levels: Customizable thresholds for overbought (default: 70.0) and oversold (default: 30.0) levels.
  • Minimum Signal Difference: Ensures strong crossovers by requiring a minimum difference between %K and %D (default: 5.0).

2. Optional Trend Filter​

An MA-based trend filter can be enabled to align signals with the market trend:
  • Trend Calculation: Uses a 10-bar linear regression slope of a Moving Average (default: 50-period SMA on close price).
  • Trend Direction: Buy signals require an upward trend (positive slope), and Sell signals require a downward trend (negative slope).
  • Customizable Settings: Adjust the MA period, method, price type, timeframe, and minimum slope threshold.

3. Multi-Symbol Scanning​

The scanner can monitor multiple symbols simultaneously:
  • Symbol Selection: Choose between scanning all symbols in the Market Watch or a custom comma-separated list (e.g., "EURUSD,GBPUSD,USDJPY").
  • Prefix/Suffix Support: Add symbol prefixes or suffixes to match broker-specific naming conventions (e.g., "EURUSDm" or "EURUSD.pro").

4. Alert System​

The scanner provides flexible alert options:
  • Alert Types: Pop-up alerts, mobile notifications, and sound alerts (with a customizable sound file, default: "alert.wav").
  • Alert Interval: Prevents repetitive alerts by enforcing a minimum wait time between alerts (default: 30 minutes).
  • Market Hours Check: Optionally restricts alerts to market hours (Monday to Friday).

5. Dashboard Display​

A visual dashboard displays the status of scanned symbols:
  • Columns: Shows the symbol, current alert (Buy/Sell), and time of the last alert.
  • Recent Alerts Section: Lists the most recent alerts with timestamps and signal types.
  • Customizable Colors: Adjust colors for Buy (default: lime), Sell (default: tomato), and other elements.

6. Interactive Chart Opening​

The dashboard supports interactive functionality:
  • Click to Open Charts: Click on a symbol in the dashboard to open its chart on the specified timeframe (default: matches the scanner’s timeframe).
  • Recent Alerts Navigation: Click on a recent alert to open the corresponding symbol’s chart.

7. Performance and Reliability​

The scanner is optimized for performance and reliability:
  • Efficient Data Retrieval: Uses MT4’s iMA function to retrieve MA data, with error handling to ensure reliable operation.
  • Refresh Interval: Adjustable refresh time (default: 5 seconds) to balance performance and responsiveness.
  • Historical Data Check: Ensures sufficient historical data is available before generating signals, with retries for failed data requests.

How to Use the Scanner​

Installation​

  1. Download the Indicator: Obtain the Stochastic_MA_Scanner_v1.03.ex4 file from Advance Quants (https://advancequants.com).
  2. Install in MT4:
    • Open MT4 and go to File > Open Data Folder.
    • Navigate to MQL4 > Indicators.
    • Copy the Stochastic_MA_Scanner_v1.03.ex4 file into this folder.
  3. To compile the Indicator:
    • Restart MT4 and drag the indicator onto any chart.
  4. Apply to a Chart:
    • In MT4, open a chart (any symbol/timeframe).
    • In the Navigator panel (Ctrl+N to show), find Stochastic_MA_Scanner_v1.03 under Indicators.
    • Drag the indicator onto the chart or double-click to apply it.
    • The settings window will appear for configuration.

Configuration​

The scanner offers a range of customizable settings, grouped into categories:​

  • Refresh Time Settings:
    • refreshTime: Refresh interval in seconds (default: 5). Increase for better performance when scanning many symbols.
  • Stochastic Settings:
    • timeframe: Timeframe for Stochastic calculation (default: PERIOD_M15).
    • kPeriod, dPeriod, slowing: Stochastic parameters (default: 5, 3, 3).
    • maMethod: MA method for Stochastic (default: MODE_LWMA).
    • priceField: Price type for Stochastic (default: 0 for Low/High).
    • overBoughtLevel, overSoldLevel: Overbought/oversold thresholds (default: 70.0, 30.0).
    • minSignalDiff: Minimum difference between %K and %D (default: 5.0).
  • MA Trend Filter Settings:
    • useTrendFilter: Enable/disable the trend filter (default: Yes).
    • trendTimeframe: Timeframe for MA calculation (default: PERIOD_M15).
    • trendMAPeriod: MA period (default: 50).
    • trendMAMethod: MA method (default: MODE_SMA).
    • trendMAPrice: Price type for MA (default: PRICE_CLOSE).
    • minTrendSlope: Minimum slope threshold (default: 0.1).
  • Alert Settings:
    • usePopUpAlerts, useMobileAlerts, useSoundAlerts: Enable alert types (default: true, false, false).
    • soundFile: Sound file for alerts (default: "alert.wav").
    • alertInternalMinutes: Minimum time between alerts (default: 30 minutes).
    • checkMarketHours: Restrict alerts to market hours (default: true).
  • Symbol Settings:
    • symTypeChoice: Scan Market Watch or a custom list (default: MarketWatch).
    • symbols: Custom symbol list (e.g., "EURUSD,GBPUSD,USDJPY").
    • symbolPrefix, symbolSuffix: Add prefixes/suffixes to symbols (default: empty).
  • Server Settings:
    • useDashboard: Enable/disable the dashboard (default: Yes).
    • timeChoiceOption: Use server or local time for alerts (default: Server).
  • Colors Settings:
    • useColors: Enable color coding (default: true).
    • buyColor, sellColor: Colors for Buy/Sell signals (default: clrLime, clrTomato).

Operation​

  1. Attach to a Chart: Apply the scanner to a chart (e.g., EURUSD M15). It will scan all specified symbols, not just the chart’s symbol.
  2. Monitor the Dashboard: If enabled, the dashboard will display the status of each symbol, including the latest alert and timestamp.
  3. Receive Alerts: When a signal is detected, you’ll receive a pop-up, mobile notification, or sound alert (based on your settings).
  4. Interact with the Dashboard: Click on a symbol to open its chart, or click on a recent alert to view the corresponding chart.
  5. Review Logs: Check the Experts tab in MT4 for detailed logs, including MA values, slope calculations, and signal filtering reasons.

Practical Example​

Settings:​

  • Timeframe: PERIOD_M5 (for both Stochastic and trend filter)
  • Stochastic Parameters: kPeriod=5, dPeriod=3, slowing=3, overBoughtLevel=70.0, overSoldLevel=30.0, minSignalDiff=5.0
  • Trend Filter: Enabled, trendMAPeriod=50, trendMAMethod=MODE_SMA, trendMAPrice=PRICE_CLOSE, minTrendSlope=0.5 (adjusted for indices)
  • Symbols: "SPX500,SUI20,NAS100"
  • Alerts: Pop-up alerts enabled, alertInternalMinutes=30
  • Dashboard: Enabled

Scenario:​

  • You attach the scanner to an EURUSD M15 chart, but it scans SPX500, SUI20, and NAS100 on the M5 timeframe.
  • At 2025.03.15 09:01:01, the scanner evaluates SUI20:
    • Stochastic: The main line (%K) crosses below the signal line (%D) at 75.0 (overbought), with a difference of 6.0 (> 5.0), indicating a potential Sell signal.
    • MA Trend: The 10-bar linear regression slope of the 50-period SMA is calculated:
      • MA values: Curr0=12945.14, Prev1=12944.55, ..., Prev9=12938.198
      • Slope: 0.748 (positive, indicating an uptrend)
    • Result: The Sell signal is filtered because the MA is trending up (slope > 0).
    • The log shows:
      MA trend check for SUI20 on timeframe PERIOD_M5: Curr0=12945.14, Prev1=12944.55, ..., Prev9=12938.198, signal=-1
      MA slope (points per bar) for SUI20: 0.748
      Sell signal filtered: MA not trending down for SUI20
      Reason: MA is trending up for SUI20
  • Later, the scanner detects a Buy signal on NAS100:
    • Stochastic: %K crosses above %D at 25.0 (oversold), difference of 5.5.
    • MA Trend: Slope is 1.2 (positive, above 0.5).
    • Result: A Buy alert is triggered, and the dashboard updates with "NAS100 M5 BUY" and the timestamp.

Tips for Optimization​

  1. Adjust the Refresh Interval:
    • If scanning many symbols, increase refreshTime (e.g., to 10 seconds) to reduce CPU load.
  2. Fine-Tune the Trend Filter:
    • For forex pairs, reduce minTrendSlope to 0.0001 to account for smaller price movements.
    • For indices like SPX500, a higher threshold (e.g., 0.5) ensures stronger trends.
    • Experiment with trendMAPeriod (e.g., 20 for faster response, 100 for smoother trends).
  3. Optimize Symbol List:
    • Use a focused list of symbols to reduce processing time (e.g., "EURUSD,GBPUSD,USDJPY").
    • Ensure symbols match your broker’s naming conventions using symbolPrefix and symbolSuffix.
  4. Test Across Timeframes:
    • Test the scanner on different timeframes (e.g., M5, M15, H1) to find the best balance of signal frequency and reliability.
  5. Monitor Logs:
    • Regularly check the Experts tab for detailed logs to understand why signals are triggered or filtered.
  6. Customize Alerts:
    • Enable mobile notifications (useMobileAlerts) for real-time updates when away from your computer.
    • Adjust alertInternalMinutes to control alert frequency.

Conclusion​

The Stochastic MA Scanner v1.03 for MT4 is a versatile and reliable tool for traders seeking to automate the identification of trading opportunities across multiple symbols. By combining Stochastic oscillator signals with an optional MA trend filter, it offers a balanced approach to momentum and trend-based trading. Its multi-symbol scanning, customizable alerts, and interactive dashboard make it an invaluable addition to any trader’s toolkit. With proper configuration and optimization, this scanner can help you stay ahead of the markets, whether you’re trading forex, indices, or other instruments. For more information, visit Advance Quants. Happy trading!
 

Attachments

  • Stochastic_MA_Scanner_v1.03.ex4
    58.2 KB · Views: 9
Last edited:
Back
Top