Stochastic Multi-Currency EA: Comprehensive User Guide, Backtest Results, and Optimized Set Files

23 November 2024, 14:40
Biswarup Banerjee
0
460

Complete User Documentation — MT4 & MT5

1. OVERVIEW

This EA automates trading across multiple currency pairs from a single chart, using the Stochastic Oscillator as its core signal engine. It doesn't just give you a basic overbought/oversold readout — you get eight distinct entry strategies and eight exit strategies, plus divergence detection and a trend filter voting system. The real problem it solves is the nightmare of manually scanning several pairs across multiple timeframes for stochastic setups, then trying to execute consistently. It handles the scanning, the signal generation, and the trade management for you.

Who Should Use It: Retail forex traders who want a systematic, multi-pair stochastic strategy without having to sit in front of the charts all day. It's especially useful if you trade multiple timeframes or like to combine stochastic signals with a trend filter.

Main Benefit: You get a complete, customizable stochastic trading system that scans, enters, manages risk, and exits across up to 28 pairs — all from one chart.


2. INPUT PARAMETERS & SETTINGS

This product shares a common set of general input settings with all Multi-Currency Scanner Dashboard products in this series. The following sections are covered in the common guide: General Settings (pairs list, dashboard colors, panel size), Timeframe Signal Settings (individual TF scan per symbol), Timeframe Confluence Settings (multi-TF confluence scan), and Alert Settings (popup, push notification, email). For full details refer to the Common Multi-Currency Scanner Dashboard Settings Guide. The sections below cover only the product-specific inputs unique to this product.

General Settings

These settings control how the EA displays virtual stop-loss and take-profit lines on the chart, how it handles group-level risk across multiple positions, whether swap costs are factored into profit calculations, and whether historical trade data is recorded for backtest analysis.

Setting Name Type Default Value Description Example
Chart lines for virtual SL/TP (never drawn during optimization) bool false When enabled, the EA draws horizontal lines on the chart showing where your virtual stop-loss and take-profit levels are placed. This is purely visual — it helps you see the levels without them being sent to the broker. During optimization, these lines are never drawn to avoid slowing things down. true — Enable when you want to visually confirm your SL/TP levels on the chart during live trading or manual backtesting.
Group Stoploss Amount double 0 Sets a maximum total loss in account currency for all positions opened by this EA across all pairs. Once the combined loss hits this amount, all trades are closed. Use this to cap your portfolio-level risk rather than per-trade risk. 50 — If you have a $500 account and want to risk no more than $50 total across all pairs, set this to 50.
Include Swap charges in Profit bool true When true, swap (overnight interest) charges are included when calculating total profit or loss for the EA. This matters if you hold trades for days — swap can eat into profits or add to losses, so including it gives a truer picture of performance. true — Keep this on for realistic backtesting and live trading, especially if you hold positions overnight.
Enable history for backtests or optimization bool false When enabled, the EA records detailed trade history during backtests or optimizations, which you can review in the Strategy Tester report. Disable it to speed up optimization runs, since writing history data takes extra processing time. true — Enable only during final backtesting when you need detailed trade logs. Disable during broad optimization to save time.

Atr Trailingstop Settings

These settings let you activate a trailing stop-loss that adjusts automatically based on market volatility using the Average True Range (ATR) indicator, with separate multipliers for activation, distance, and increment.

Setting Name Type Default Value Description Example
Use ATR Trailing Stop bool false Master switch for the ATR-based trailing stop. When enabled, the EA will automatically move your stop-loss as price moves in your favor, using ATR to determine the distance. This adapts to changing volatility — tighter stops in quiet markets, wider in volatile ones. true — Enable if you want a dynamic trailing stop that adjusts to market conditions rather than a fixed pip distance.
ATR Timeframe ENUM PERIOD_CURRENT Selects the timeframe used to calculate the ATR value for the trailing stop. Using a higher timeframe (like H1 or H4) gives a broader volatility measure, while the current chart timeframe reacts faster to recent price action. PERIOD_H1 — Use H1 ATR for a smoother, less jumpy trailing stop that filters out noise from lower timeframes.
ATR Period int 14 The number of bars used to calculate the ATR value. A shorter period (like 7) makes the trailing stop more responsive to recent volatility changes, while a longer period (like 21) smooths out spikes and gives a more stable average. 10 — Use a shorter period if you want the trailing stop to tighten quickly after a volatility spike.
Activation (ATR multiplier) double 2.0 The profit distance (in ATR units) that must be reached before the trailing stop activates. For example, a value of 2.0 means the trade must be 2 ATRs in profit before the stop starts trailing. This prevents the stop from moving too early. 1.5 — Use a lower multiplier like 1.5 for quicker activation on shorter timeframes, giving the trade room but not waiting too long.
Trail distance (ATR multiplier) double 1.0 The fixed distance (in ATR units) that the trailing stop will maintain behind the current price once activated. A value of 1.0 means the stop stays 1 ATR away from the highest price reached. Smaller values give a tighter stop but risk early exit on pullbacks. 0.8 — Use a tighter trail distance like 0.8 for scalping on M5, where you want to lock in profits quickly.
Trail increment (ATR multiplier) double 0.5 The minimum price movement (in ATR units) required for the trailing stop to update. A value of 0.5 means the stop only moves when price advances by at least 0.5 ATR. This reduces unnecessary stop adjustments and keeps the stop stable during minor fluctuations. 0.3 — Use a smaller increment like 0.3 for a more responsive trailing stop that updates frequently on fast-moving pairs.

Grid Settings

This setting controls whether the EA attempts to recover losses from all open grid trades by closing them as a group when total profit reaches a target.

Setting Name Type Default Value Description Example
Recover profit from all grid trades bool false When enabled, the EA will monitor the combined profit of all open trades and close them all when the total reaches a positive level, effectively recovering from any drawdown. This is useful for grid or martingale strategies where you want to exit all positions once the basket is profitable. true — Enable if you run a grid strategy and want the EA to automatically close all trades when the overall basket turns profitable.

Safeguard Settings

These settings provide risk controls and backtest validation — you can set a maximum loss limit, enforce minimum profit and trade counts, and define a maximum inactivity period to stop the EA if it stops trading.

Setting Name Type Default Value Description Example
Max Loss from initial balance [0: disable] double 0.0 Sets a maximum drawdown limit as a percentage of the initial account balance. Once the account drops by this percentage from the starting balance, the EA stops opening new trades. This is a hard safety net to prevent runaway losses during unfavorable market conditions. 20 — Set to 20 to stop trading if the account loses 20% from the starting balance, preserving capital for later.
Minimum Profit Percent [backtesting only] [0: disable] double 0 During backtesting, the EA will stop and report a failure if the total profit percentage falls below this threshold. Use this to filter out parameter sets that don't meet your minimum profitability criteria during optimization. 5 — Set to 5 to reject any optimization run that doesn't achieve at least 5% profit over the test period.
Minimum Trades [backtesting only] [0: disable] double 0 During backtesting, the EA will stop and report a failure if the total number of trades falls below this threshold. This helps you avoid parameter sets that produce too few trades to be statistically reliable. 50 — Set to 50 to ensure any viable parameter set generates at least 50 trades during the backtest period.
Max inactive days [backtesting only] [0: disable] int 0 During backtesting, the EA will stop and report a failure if no trades are opened for this many consecutive days. This helps you detect parameter sets that stop trading for long periods, which might indicate a flawed strategy. 30 — Set to 30 to reject any run where the EA goes a month without opening a trade.

Stochastic Settings

These settings define the core Stochastic Oscillator parameters — timeframe, K and D periods, slowing factor, MA method, price field, calculation mode, overbought/oversold levels, and the entry and exit strategies that determine when trades are opened and closed.

Setting Name Type Default Value Description Example
Stochastic timeframe ENUM PERIOD_CURRENT Selects the timeframe on which the Stochastic Oscillator is calculated. Using a higher timeframe (like H1) gives broader, more reliable signals, while the current chart timeframe reacts faster to recent price action. Choose based on your trading style. PERIOD_H1 — Use H1 for swing trading where you want fewer, higher-probability signals.
K period for Stochastic int 14 The number of periods used to calculate the %K line, which is the main stochastic line. A lower value (like 5) makes the indicator more sensitive to price changes, generating more signals. A higher value (like 21) smooths the line and reduces false signals. 10 — Use a K period of 10 for a faster response on M15, catching quick reversals.
D period for Stochastic int 3 The smoothing period for the %D line, which is a moving average of %K. A higher D period (like 5) produces a smoother signal line, reducing noise and false crossovers. A lower value (like 2) keeps the signal line closer to %K for earlier signals. 5 — Use a D period of 5 for a smoother signal line that filters out minor crossovers on H1.
Slowing factor for Stochastic int 3 An internal smoothing applied to the %K line before the %D line is calculated. A higher slowing factor (like 5) makes the stochastic less sensitive, reducing whipsaws. A lower factor (like 1) makes it more responsive but prone to false signals. 2 — Use a slowing factor of 2 for quicker signals in volatile markets like GBP/JPY.
Moving Average method (0: Simple, 1: Exponential, etc.) ENUM MODE_SMA See options explained below. MODE_EMA — Use Exponential for a more responsive moving average that reacts faster to recent price changes.
Price field (0: Close/Close, 1: High/Low, etc.) ENUM STO_LOWHIGH See options explained below. STO_CLOSE — Use Close/Close for a standard stochastic that only considers closing prices, reducing noise from intra-bar extremes.
Calculation Mode(Useful for backtesting) ENUM MANUAL See options explained below. AUTO — Use AUTO during backtesting to let the EA calculate overbought/oversold levels dynamically based on recent data.
stochastic upper LEVEL double 80 The upper threshold for overbought conditions. When the stochastic line crosses above this level, the market is considered overbought. Raising this level (to 90) makes the overbought condition stricter, reducing false signals but potentially missing early reversals. 85 — Use 85 for a slightly stricter overbought threshold on trending pairs like USD/JPY.
stochastic lower LEVEL double 20 The lower threshold for oversold conditions. When the stochastic line crosses below this level, the market is considered oversold. Lowering this level (to 10) makes the oversold condition stricter, which can help avoid premature buy signals in strong downtrends. 15 — Use 15 for a slightly stricter oversold threshold on volatile pairs like GBP/AUD.
Entry Strategy ENUM ENTRY_STRATEGY1 See options explained below. ENTRY_STRATEGY3 — Use for overbought conditions to sell, ideal for range-bound markets.
Exit Strategy ENUM EXIT_STRATEGY0 See options explained below. EXIT_STRATEGY2 — Use to exit long trades when the stochastic exits overbought, locking in profits before a reversal.

Calculation Mode — Options Explained

This setting determines how the EA calculates the overbought and oversold levels for the stochastic indicator. It's particularly useful during backtesting to adapt levels to different market conditions.

MANUAL: The EA uses the exact upper and lower levels you provide in the 'stochastic upper LEVEL' and 'stochastic lower LEVEL' settings. This gives you full control and is the standard approach for most trading scenarios.

AUTO: The EA automatically calculates the upper and lower levels based on recent price data. If both levels are provided, it calculates based on the upper level. This is useful during backtesting to see how the strategy performs with adaptive levels, but it can lead to inconsistent signals in live trading.

Entry Strategy — Options Explained

The Entry Strategy setting lets you choose exactly how the stochastic oscillator triggers a new trade. Each strategy defines a specific condition for buy and sell entries, so you can match the logic to your market view.

ENTRY_STRATEGY0: Disables all entry signals. The EA will not open any new trades based on stochastic conditions. Use this if you only want the EA to manage existing positions or use other filters.

ENTRY_STRATEGY1: Buy when the stochastic enters oversold territory (crosses below the lower level). Sell when it enters overbought territory (crosses above the upper level). This is the classic reversal strategy, good for range-bound markets.

ENTRY_STRATEGY


3. HOW IT WORKS

Core Calculation & Logic

The Stochastic Multi-Currency EA continuously monitors the stochastic oscillator on each symbol you've listed in the SYMBOLS parameter. For every bar, it calculates the %K and %D lines using your chosen K period, D period, and slowing factor. The EA then compares these values against the upper and lower levels you've set (default 80/20) to identify overbought and oversold zones. What makes this EA different from a simple indicator overlay is that it applies your selected entry strategy across all pairs simultaneously — it's not just watching one chart, it's scanning the whole list for setups.

Behind the scenes, the EA uses a single-chart architecture: you attach it to one chart (any pair, any timeframe) and it handles the rest via SymbolInfoTick() and custom stochastic calculations. The EA doesn't rely on the built-in Stochastic indicator — it computes everything internally, which gives you consistent results across MT4 and MT5. The calculation mode setting (MANUAL vs AUTO) controls whether the EA uses the current price or the last completed bar for its signals, which matters most during backtesting where you want to avoid look-ahead bias.

Entry Strategies Explained

Each strategy defines a specific pair of conditions for entering long and short positions. You'll pick one via the Entry Strategy parameter. Here's what each one does in plain terms:

ENTRY_STRATEGY1 — Classic Reversal

BUY Signal: When the stochastic line crosses down into oversold territory (below the lower level).

SELL Signal: When the stochastic line crosses up into overbought territory (above the upper level).

Best For: Range-bound markets where price tends to bounce between support and resistance. You're catching the turn before it happens.

ENTRY_STRATEGY2 — Momentum Breakout

BUY Signal: When the stochastic line crosses up out of oversold territory (exits below the lower level).

SELL Signal: When the stochastic line crosses down out of overbought territory (exits above the upper level).

Best For: Trending markets where you want to join the move after the initial thrust, not try to pick the exact bottom or top.

ENTRY_STRATEGY3 — Overbought Aggression

BUY Signal: When the stochastic line crosses up into overbought territory (above the upper level).

SELL Signal: When the stochastic line crosses down into oversold territory (below the lower level).

Best For: Strong momentum trends where you expect the move to continue even after extreme readings. High risk, high reward.

ENTRY_STRATEGY4 — Crossover Confirmation

BUY Signal: When the stochastic %K line crosses below the lower level.

SELL Signal: When the stochastic %K line crosses above the upper level.

Best For: Traders who want a clean, unambiguous trigger — the crossover of the level itself, not just entering the zone.

ENTRY_STRATEGY5 — Mid-Line Momentum

BUY Signal: When the stochastic %K line crosses above the 50 level.

SELL Signal: When the stochastic %K line crosses below the 50 level.

Best For: Neutral market conditions where you want to trade the middle of the range rather than extremes. Good for scalping on lower timeframes.

ENTRY_STRATEGY6 — Extreme Persistence

BUY Signal: When the stochastic %K line is above the upper level (already overbought).

SELL Signal: When the stochastic %K line is below the lower level (already oversold).

Best For: Strong trending markets where you expect the overbought/oversold condition to persist. Counter-intuitive but can work with a good filter.

ENTRY_STRATEGY7 — Divergence Play

BUY Signal: When a bullish divergence forms — price makes a lower low while stochastic makes a higher low.

SELL Signal: When a bearish divergence forms — price makes a higher high while stochastic makes a lower high.

Best For: Reversal traders who want to catch trend exhaustion. Requires the divergence settings to be tuned properly (see next section).

ENTRY_STRATEGY8 — %K/%D Crossover

BUY Signal: When the %K line crosses up through the %D line.

SELL Signal: When the %K line crosses down through the %D line.

Best For: Classic stochastic crossover trading. Works best in non-trending markets where the lines oscillate frequently.

Step-by-Step Workflow

Step 1: Attach to any chart. Open a chart on any pair and timeframe — the EA will scan the symbols you define, not the chart pair itself. I usually attach it to a 1-minute EURUSD chart just to keep it running.

Step 2: Set your symbol list. In the SYMBOLS parameter, enter the pairs you want to trade, comma-separated. Example: EURUSD,GBPUSD,USDJPY,AUDUSD . The EA will open positions on these pairs regardless of the chart pair.

Step 3: Choose your entry strategy. Pick one of the 8 strategies from the dropdown. If you're new, start with ENTRY_STRATEGY1 — it's the most intuitive.

Step 4: Configure risk. Set your lot size, stop loss, and take profit. If you're unsure, leave stop loss at 0 and use a fixed amount or percent mode instead.

Step 5: Enable alerts (optional). Turn on popup or push notifications if you want to be notified when a signal fires. The EA will still trade automatically regardless.

Step 6: Run a backtest first. Use the Visual Tester with the Calculation Mode set to AUTO to avoid look-ahead. Watch how the EA behaves on different pairs before going live.

Step 7: Go live with a demo account. Run it on a demo for at least a week. Check that the signals match what you see on the stochastic indicator manually.


4. RISK MANAGEMENT FEATURES

The EA includes several built-in risk controls that let you manage exposure across multiple pairs from a single chart. Here's what each one does:

Feature Description
Lot Size Fixed lot size applied to every trade. Default is 0.01. For a $1,000 account, I'd keep this at 0.01 or 0.02 to avoid over-leveraging when multiple signals fire at once.
Stop Loss / Take Profit Modes Choose from Pips, Amount, Percent, Group Amount, Group Percent, or No SL/TP. The Group modes calculate SL/TP across all open positions from this EA — useful if you want to cap total portfolio risk rather than per-trade risk.
Hidden SL/TP When enabled, the EA manages stop loss and take profit internally without sending them to the broker. This prevents your stops from being hunted. The chart lines are optional and won't appear during optimization.
Group Stop Loss / Take Profit Set a maximum loss or profit target for the entire portfolio of trades opened by this EA. Once the group loss hits the threshold, all positions are closed. This is your circuit breaker.
Risk-Reward Ratio If you set a stop loss but leave take profit at 0, the EA can calculate TP automatically based on a fixed risk-reward ratio. Default is 1:2, but you can adjust it to your preference.

5. IMPORTANT NOTES & WARNINGS

Known Limitations

Issue Explanation
Single-Chart Dependency The EA must remain attached to a chart to run. If you close the chart or restart the platform, the EA stops. Use a VPS and keep the chart open 24/7.
No Multi-Timeframe Scanning The EA uses a single timeframe for all calculations — the one you set in Stochastic timeframe. It doesn't scan multiple timeframes simultaneously. If you need that, use the Scanner version instead.
Backtest Accuracy Depends on Calculation Mode In MANUAL mode (default), the EA uses current price for signals, which can cause look-ahead bias in backtests. Always switch to AUTO mode when running historical tests.
Divergence Strategy Requires Tuning Strategy 7 (divergence) needs careful adjustment of the divergence lookback and sensitivity settings. Defaults may produce too few or too many signals depending on market conditions.
No News Filter The EA doesn't check economic calendars. If a major news event hits while multiple signals are active, you could see large drawdowns. Consider using a separate news filter EA alongside this one.

Settings Beginners Should NOT Change

Setting Why to Leave Default
Calculation Mode Default is MANUAL, which works fine for live trading. Switching to AUTO changes how signals are generated and can confuse beginners. Only change this if you understand the implications.
Slowing Factor The default of 3 provides a good balance between responsiveness and noise. Lower values (1-2) produce too many false signals; higher values (5+) make the indicator too slow.
Price Field STO_LOWHIGH (High/Low) is the standard for stochastic calculations. Changing to STO_CLOSE (Close/Close) alters the indicator's behavior significantly and is rarely used in practice.
Moving Average Method Simple moving average (MODE_SMA) is the most common and predictable. Exponential (MODE_EMA) gives faster signals but also more whipsaws. Stick with SMA until you're comfortable.
Group Stop Loss / Take Profit Default is 0 (disabled). If you set a group stop loss without understanding how it aggregates across pairs, you might close all positions prematurely. Test this on demo first.

Dashboard Usage Tips

  1. Start with one pair: Don't throw 10 pairs at the EA on day one. Run it on EURUSD only for a week, verify the signals match your manual analysis, then add pairs gradually.
  2. Use the Visual Tester: Before going live, run a visual backtest over 3-6 months. Watch how the EA enters and exits. You'll spot issues like over-trading or poor timing that a non-visual test won't show.
  3. Match your timeframe to your strategy: If you're using ENTRY_STRATEGY5 (mid-line momentum), the M1 timeframe will produce dozens of signals per day. For swing trading, use H1 or H4 with ENTRY_STRATEGY1 or 7.
  4. Set alerts for divergence: If you're using Strategy 7, enable popup alerts. Divergence signals are rarer and you'll want to know immediately when one fires so you can check the chart manually.
  5. Don't mix strategies: The EA only uses one entry strategy at a time. Don't try to run multiple instances with different strategies on the same account — they'll conflict and you'll end up with opposing positions.
  6. Monitor drawdown daily: With multiple pairs trading simultaneously, your total exposure can spike. Check your account equity at least once a day, especially during high-impact news days.

Quick Start Guide

Follow these steps to get started in under 5 minutes:

  1. Attach the EA to a chart: Open any chart (I use EURUSD M1), drag the EA onto it. Make sure AutoTrading is enabled in MetaTrader.
  2. Set your symbols: In the EA properties, find the SYMBOLS parameter. Enter the pairs you want to trade, separated by commas. Example: EURUSD,GBPUSD,USDJPY .
  3. Choose an entry strategy: Set Entry Strategy to ENTRY_STRATEGY1 if you're new. This is the classic overbought/oversold reversal method.
  4. Configure lot size: Set Lot Size to 0.01 for a standard account or 0.1 for a cent account. Never risk more than 1-2

    Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Backtest and Set Files

    Check all my products: https://www.mql5.com/en/users/biswait50/seller

    Contact me for support: https://www.mql5.com/en/users/biswait50