Direct answer: what a worked example means for MT4
A worked example of an MT4 Expert Advisor (EA) is a fully spelled-out scenario that shows the EA’s rule logic applied to specific assumed inputs. You explicitly state every assumption (prices, account balance, risk settings, spread/fees, and order rules) and then compute what the EA would do step by step. This makes it possible to explain the concept accurately and independently check whether the calculations match the stated rules.
An EA in MetaTrader 4 is software that can automatically evaluate conditions and place or manage orders according to programmed rules. A worked example focuses on the mechanics of those rules (the mapping from inputs to actions), not on promises about future profits.
Mechanics: what an MT4 EA typically needs to know
An MT4 EA usually needs:
- Trigger conditions: when to consider entering or exiting (for example, “when price crosses X” or “when a flag is true”).
- Order parameters: what to trade (symbol), direction (buy/sell), and position sizing.
- Risk controls: how to translate a risk setting into a trade size, such as using a stop-loss distance.
- Execution rules: how to handle orders (market vs. pending, whether to allow multiple positions, and how to act if an order fails).
Key distinction for a worked example: stable mechanics are the deterministic parts (formulas and rule evaluation). Variable conditions are everything that can differ in real execution: exact fill price, costs, and whether the platform could place the order when expected.
Worked numerical scenario (with explicit assumptions)
Below is one simplified worked example. It is intentionally generic and does not depend on real-time data.
Assumptions
- Account balance: $10,000
- Risk per trade: 1% of balance = $100
- Trade type: one position with a stop-loss (SL) at a fixed distance.
- Assumed entry price: 1.10000
- Assumed SL distance: 50 pips
- Take-profit (TP): not required for risk sizing, but the EA may set one; we will omit TP to keep the arithmetic focused.
- Pip value per standard lot: assume $10 per pip (a simplification used for illustration)
- Spread and commission: assumed ignored for sizing (but discussed as a limitation later)
- Only one trade at a time: assume the EA will place at most one position in this example.
Step 1: compute allowed loss in dollars
Risk amount = 1% × $10,000 = $100
Step 2: convert SL distance into a dollar-per-lot loss
Dollar loss per lot if SL hits = 50 pips × $10 per pip = $500
Step 3: compute position size (lots) to match the risk
Lots = Risk amount ÷ Loss per lot = $100 ÷ $500 = 0.20 lots
Step 4: what the EA does next (rule-driven)
Given the trigger is assumed to be true at the moment of evaluation:
- The EA sends a buy (or sell, depending on the trigger) for 0.20 lots.
- It sets the SL 50 pips away from the assumed entry price.
- If the platform accepts the order, subsequent ticks cause the EA to monitor and manage exits per its rules.
This is the essence of a worked example: you can see how a risk setting becomes a numeric lot size using stated assumptions.
Limitations and risks: where outcomes can diverge
Even when the arithmetic is correct, real results can differ because:
- Execution price differs from the assumed entry: fills can be worse due to spread changes or slippage.
- Costs can be ignored in the sizing example: commissions, financing, and wider effective costs can change realized results.
- Stop-loss placement may not behave as expected: in fast markets, the effective exit can differ from the intended SL distance.
- Rule-logic failure modes: the EA may not place the order if conditions are not met at execution time, or it may behave unexpectedly if the trigger logic conflicts with order management logic.
Because of these effects, historical or simulated results do not reliably predict future outcomes.
Verification: how to independently check a worked example
You can verify the worked example logic without relying on claims of performance:
- Recalculate the position size using the same stated assumptions (risk %, SL distance, and pip value). - Match to the EA’s configuration: confirm the EA is set to use the same risk method and stop distance.