ForexBestRobots.comCompare EAs →
EN

Forex scalping · Guide 3

How to Backtest a Forex Scalping Strategy in MT4: Data and Execution

Audit an MT4 scalping backtest with tick provenance, closed-bar timing, Bid/Ask, ambiguous exits, costs, execution stresses and forward validation.

Auditing a Forex scalping backtest in MT4: data provenance, signal timing, quote sequence and complete costs.
Auditing a Forex scalping backtest in MT4: data provenance, signal timing, quote sequence and complete costs.

A scalping backtest is only as useful as its timeline, quotes and cost ledger. Learn to audit standard MT4 modelling, resolve what a candle cannot tell you, reconcile fills without charging spread twice and separate a promising-looking report from evidence that still needs testing.

1. What a scalping backtest needs to establish

A useful Forex scalping backtest checks whether a precisely defined method could have acted on information available at the time, at executable prices, after relevant costs and losses. A rising balance line cannot answer that on its own. Small targets make quote-side mistakes, invented intrabar ordering and optimistic fills proportionally more important than they might appear on a slower chart.

Separate three questions: whether the trading hypothesis is worth studying, whether the EA implements it correctly, and whether the account can execute it under the assumed conditions. A clean program can automate a weak idea; a promising hypothesis can be ruined by an implementation error. Good historical performance under a simplified execution model does not establish live viability or future profitability.

This guide supplies an audit process, not a tested strategy or broker result. All prices, counts and monetary examples are fictional. The general MT4 backtesting guide covers the basic workflow. Here we focus on short holding periods, tick provenance, closed-bar timing, Bid/Ask, ambiguous exits, complete cost accounting and the evidence needed before forward validation.

2. Freeze the rules and the version before collecting results

Write the symbol, timeframe, session definition, signal conditions, entry deadline, stop, target, time exit and rejection rules before testing. Specify whether the signal uses a completed candle or a changing current candle. A phrase such as “enter after confirmation” is incomplete until the confirmation event and the first permissible decision time are observable and reproducible.

Save the EA version, inputs, terminal build, account currency, contract specification and data source. Record minimum volume, lot step, stop restrictions and the intended risk budget. Define how orders already open at a test boundary are treated, and prevent duplicate entries from repeated processing of the same signal. A manual replay needs the same rules and a record of skipped opportunities. A filename alone is not a version identifier: keep a file hash or another reproducible reference, and record any indicator or configuration the EA depends on. Otherwise two reports can appear to test the same system while actually running different logic.

Keep the research procedure separate from commercial product claims. A demonstration of a cost calculation is not evidence that an EA generated those trades. Do not substitute a newly drawn educational curve for an original Strategy Tester report. The M1 and M5 scalping guide explains the underlying trading style; this article asks how to test its assumptions honestly.

3. Audit the data before the strategy

Distinguish bar records, timestamped Bid/Ask observations and actual execution records. OHLC bars summarise prices but do not preserve every quote or its sequence. A file called tick data is not sufficient evidence: identify its source, timestamp resolution, symbol, timezone, price sides, coverage and any transformations. Paired historical quotes still do not contain your broker’s actual fills or order rejections.

Check ordering, duplicate timestamps, missing intervals, stale quotes and implausible spreads. Multiple updates within the same second can be legitimate; do not delete them merely because their timestamps match. Preserve a sequence identifier where available. A zero or missing spread is not proof of costless trading. Quarantine questionable records and disclose the affected interval rather than silently repairing it with future information.

Verify units before converting: for the EUR/USD examples here, 1 pip = 0.0001 and, with five decimals, 1 point = 0.00001. Tick size is a price increment, while a tick observation is an update. Importing bar data through History Center does not by itself establish a recorded two-sided tick replay. Keep an auditable link from original files through conversion to the actual test input. When comparing bars and quotes, reconstruct the bars under the same timestamp boundaries and check their OHLC. Agreement helps detect conversion errors but cannot restore missing observations. Differences between feeds need investigation; they are not automatically evidence of dishonest reporting.

Bars, paired Bid/Ask observations and execution records answer different questions. Preserve provenance, coverage, units and ordering.
Bars, paired Bid/Ask observations and execution records answer different questions. Preserve provenance, coverage, units and ordering. On small screens, scroll the diagram horizontally.

4. A closed-bar signal cannot trade before its information exists

Consider a fictional M1 signal candle spanning 10:00–10:01. Its final close is not available at 10:00:30. Suppose the first usable quote after the boundary appears at 10:01:02. A method that evaluates completed candles can first act on that observation, not on an assumed quote at exactly 10:01:00 and not retrospectively at the old candle’s closing price.

In MT4 time-series indexing, the current bar is index 0 and the previous bar is index 1. A stored bar-opening timestamp is not a receipt timestamp for every quote. Detect the new bar, read only information already completed, and record the signal identifier so it cannot trigger twice. If a higher-timeframe filter is used, that candle must also have been complete when the lower-timeframe decision occurred. At 10:01:02, the M5 candle spanning 10:00–10:05 is still forming. Its eventual close cannot confirm an earlier M1 entry; use only the appropriate previously completed M5 information.

Suppose a hypothetical request follows the decision at 10:01:02 and a fill is assigned at 10:01:03. That delay is an explicit scenario assumption, not a latency measurement produced by selecting Every tick. Second-resolution timestamps cannot prove ordering within a second; retain event order separately. A no-quote interval cannot be filled with a future close while still being called an executable historical entry.

The 10:00–10:01 M1 candle can first be evaluated at the fictional usable quote at 10:01:02. A fill at 10:01:03 is a scenario assumption, not measured latency.
The 10:00–10:01 M1 candle can first be evaluated at the fictional usable quote at 10:01:02. A fill at 10:01:03 is a scenario assumption, not measured latency. On small screens, scroll the diagram horizontally.

5. Understand what standard MT4 modelling can and cannot show

The standard MT4 Every tick model can generate intrabar changes by interpolation from available lower-timeframe bars. Its name does not certify replay of recorded historical Bid and Ask. The terminal’s standard historical price bars contain Bid; Ask is modelled using the selected spread, with the current spread used by default at the start unless a custom value is set. Check the spread field’s units as well: in a five-decimal EUR/USD format, 8 points are 0.8 pip. Typing a number while assuming the wrong unit can materially change a small-target test.

A closed-bar entry does not make intrabar exits irrelevant. Open prices only can help inspect a suitable bar-opening decision, but it is not adequate evidence for a scalping method whose stops, targets or trailing rules depend on the path within a candle. Control points provides a coarse approximation. Match the modelling method to every decision the system makes, including protective and time-based exits.

If a separate tick-data workflow claims variable historical spreads or a particular execution model, verify its documented data path and inspect the quotes actually consumed. Do not assume that importing a CSV activates those features automatically. Record the workflow and its limitations. A modelling-quality percentage is a platform diagnostic, not the probability that a strategy will work or a guarantee of real-world execution.

Standard modelUseful limited checkWhat it does not establish
Open prices onlySuitable bar-opening decision logicA reliable intrabar stop/target sequence for scalping
Control pointsCoarse preliminary inspectionA complete recorded execution path
Every tickMore detailed modelled intrabar inspectionRecorded two-sided ticks, variable historical spread or broker latency by its name alone

6. When stop and target are inside one candle, OHLC is not enough

Use a fictional Bid candle with Open 1.10010, High 1.10080, Low 1.09950 and Close 1.10020. Assume a BUY was opened at Ask 1.10020 before the subsequent intrabar path, with a stop triggered at Bid 1.09970 and target checked at Bid 1.10070. Both exit levels lie within the candle’s range, but the four bar values do not identify which was reached first.

A path from Open to High to Low to Close can reach the target first. A path from Open to Low to High to Close can reach the stop first. Both fit the same OHLC summary. These are alternative hypothetical price sequences, not an invented pair of recorded trades. The difference is economically decisive even when the entry signal itself used only a completed candle.

Use sufficient ordered quote evidence to resolve the sequence where possible. Otherwise flag the trade as ambiguous and report sensitivity or explicitly assumed bounds. A stop-first convention can be a conservative assumption, but it is not an observed path. Do not quietly award the target whenever both boundaries appear in a profitable-looking bar. Also distinguish a trigger level from the price of the eventual fill.

Two hypothetical Bid paths share the same OHLC but reach different exit boundaries first. The candle alone does not resolve the order.
Two hypothetical Bid paths share the same OHLC but reach different exit boundaries first. The candle alone does not resolve the order. On small screens, scroll the diagram horizontally.

7. A BUY plan: executable boundaries and cash outcomes

For the separate exact-entry plan, keep actual Ask entry 1.10020, Bid stop 1.09970 and Bid target 1.10070. Gross risk and potential gross reward are each 5 pips. The BUY stop belongs below entry and target above it. A SELL reverses the boundaries and exits on Ask; reversing a drawing without changing the executable quote side is not a valid mirror test.

Assume 0.6 pip round-trip commission and an additional 0.4-pip allowance for future adverse exit slippage. Entry is already an actual fill, so do not charge entry spread or entry slippage again. The conservative target result is 5 − 0.6 − 0.4 = 4 pips; the conservative stop result is a loss of 5 + 0.6 + 0.4 = 6 pips. Gaps can exceed that allowance.

For this example, one standard EUR/USD lot is EUR 100000 and one pip is USD 10 in a USD account. Planned loss is therefore USD 60 per lot. With an illustrative USD 25 budget and a 0.01 lot step, 25 / 60 ≈ 0.4167 rounds down to 0.41 lot, or USD 24.60. Check margin and minimum volume separately; this planning calculation does not guarantee a maximum realised loss.

BUY plan: actual Ask 1.10020, Bid stop 1.09970 below entry and Bid target 1.10070 above it. Costs turn the gross 5/5 into a planned 6-pip loss or potential 4-pip gain.
BUY plan: actual Ask 1.10020, Bid stop 1.09970 below entry and Bid target 1.10070 above it. Costs turn the gross 5/5 into a planned 6-pip loss or potential 4-pip gain. On small screens, scroll the diagram horizontally.

8. Reconcile the cost ledger without charging spread twice

Use a separate fictional fill example: decision Bid 1.10010 and Ask 1.10020, actual BUY entry 1.10022, later reference Bid 1.10070 and actual exit 1.10068. The reference Bid movement is 6 pips, entry spread 1.0 pip and combined adverse entry-and-exit slippage 0.4 pip. With 0.6 pip commission, the reference calculation is 6 − 1.0 − 0.4 − 0.6 = 4 pips.

The actual-fill calculation reaches the same result: (1.10068 − 1.10022) / 0.0001 = 4.6 pips before commission, leaving 4 pips after 0.6 pip. At the stated standard-lot USD value, that is USD 46 price profit, USD 6 commission and USD 40 net. These are alternative starting points, not two sets of deductions to combine. Keep favourable slippage signed when it occurs.

In MQL4, OrderProfit() excludes swap and commission, so its name alone does not establish the complete after-charge outcome. Reconcile the signed booked fields and any separately posted charges against the statement, including financing if the position crosses the relevant boundary. Avoid counting the same commission twice. The guide to spreads, commissions and swaps provides the general accounting framework.

Reference-movement and actual-fill calculations both give 4 pips net. At the assumed standard-lot USD value: USD 46 price profit − USD 6 commission = USD 40.
Reference-movement and actual-fill calculations both give 4 pips net. At the assumed standard-lot USD value: USD 46 price profit − USD 6 commission = USD 40. On small screens, scroll the diagram horizontally.

9. Stress spreads and execution without rewriting the strategy

Against the same fictional 6-pip reference movement, a base spread of 1.0 pip, commission of 0.6 pip and combined slippage allowance of 0.4 pip cost 2.0 pips, leaving 4.0 pips conditionally. Raising only spread to 1.8 pips costs 2.8 pips and leaves 3.2 pips. Raising only slippage to 1.2 pips also costs 2.8 pips and leaves 3.2 pips.

Combining spread 1.8 pips, commission 0.6 pip and slippage allowance 1.2 pips costs 3.6 pips, leaving 2.4 pips. These scenarios are sensitivity arithmetic, not strategy returns or forecasts. Their settings are illustrative, not recommended stress levels. Keep the signal definition frozen and disclose the assumptions rather than increasing targets or moving stops to recover an attractive result. Stress dimensions can be related: a fast announcement may coincide with wider spreads, stale quotes and adverse fills. Testing each in isolation is informative but does not establish how a jointly difficult episode would behave.

Simply subtracting a larger average cost from an old trade list does not replay the effect of changing spreads on entry eligibility, stops, targets and order state. Recalculate affected decisions with an appropriate model, or state what remains unsupported. The guide to scalping pairs and cost filters explains why account, session and pair-specific measurements belong in the assumptions.

Fictional cost stresses against the same 6-pip reference move leave 4.0, 3.2, 3.2 and 2.4 pips conditionally. They are not strategy returns.
Fictional cost stresses against the same 6-pip reference move leave 4.0, 3.2, 3.2 and 2.4 pips conditionally. They are not strategy returns. On small screens, scroll the diagram horizontally.

10. Latency, rejections and uncertain orders need explicit treatment

A historical price sequence is not a historical simulation of the broker’s execution queue. Specify any assumed request delay, price-selection rule, rejection model and order-state transition. Do not call an order failed solely because confirmation was delayed. Before retrying, reconcile the actual order state; otherwise a resilience mechanism can create duplicate positions and change the strategy’s exposure.

Sleep() does not create a delay in the standard MT4 Strategy Tester. If execution delay matters, it needs a documented simulation method that advances decisions or fills through the available quote sequence without looking ahead. A constant pip haircut cannot represent every missed fill, rejected request or changed stop trigger. The slippage, latency and requotes guide helps distinguish the observations.

The standard tester also does not exercise every live event or external dependency: Timer events and WebRequest-based interactions are among the documented limitations. Review which parts of the EA actually ran. An external news filter or heartbeat that was inactive in testing cannot be presented as validated. Test operational behaviour separately and record the difference between simulated, demonstrated and still-unverified conditions.

11. Use the right denominator and include open risk

Consider a fictional audit with 120 eligible signals. A filter blocks 18, leaving 102 submitted requests. Of those, 94 fill, 6 are rejected and 2 are cancelled. The filter rejection rate is 18 / 120 = 15%; the fill rate is 94 / 102 ≈ 92.2%. Dividing fills by all signals would answer a different question and conceal where opportunities were lost.

Suppose 90 of the filled positions are closed and 4 remain open at the reporting boundary. Average closed-trade payoff uses 90 outcomes, not 94 fills. Report the remaining exposure and its mark-to-market effect rather than treating open losses as zero. Define how partial closes, multiple tickets and cancelled requests are counted so the same economic attempt does not silently appear several times. A flat balance line can coexist with substantial floating loss. Compare drawdown definitions and include the relevant equity observations; a report that only records closed results can miss risk carried between exits.

For another purely arithmetic illustration within those 90 closed outcomes, suppose 50 net wins of USD 9 and 40 net losses of USD 8. Positive outcomes sum to USD 450, negative outcomes to USD 320, net USD 130. Average is 130 / 90 ≈ USD 1.44 and net-outcome profit factor is 450 / 320 ≈ 1.41. This invented sample proves no edge; inspect loss concentration, equity drawdown and dependence between trades as well.

12. Separate development, validation, untouched testing and forward observation

Choose chronological blocks before assessing performance: A for development, B for validation, C for a final untouched historical check and D for forward observation. Their lengths must follow the research question and available market conditions, not a universal trade-count target. Tuning repeatedly against C turns it into another development sample even if the report still labels it out of sample.

Warm-up history before a scored block can be used to initialise backward-looking indicators. It must not use future observations, future session statistics or later revisions to improve earlier decisions. State whether positions carry across boundaries and how their costs and outcomes are assigned. A gap or reset may be appropriate for a particular design, but it needs an explicit reason rather than a cosmetic improvement in results. External features also need their original release times. A revised economic series or a session average computed from the whole future day can leak information even when the price indicator uses only completed candles.

Preserve the order of market episodes when reviewing uncertainty. Nearby scalps can share the same trend, news event or liquidity problem; many trades are not automatically many independent observations. Keep a versioned record of every rule change and every discarded candidate. The optimization and overfitting guide explains how selection can consume apparently separate validation evidence.

Use chronological development, validation, untouched testing and forward blocks. Warm-up may use past data but cannot import future information.
Use chronological development, validation, untouched testing and forward blocks. Warm-up may use past data but cannot import future information. On small screens, scroll the diagram horizontally.

13. Count the search, not just the winning settings

Suppose a hypothetical search tries 5 entry settings, 4 stop settings and 3 target settings: 5 × 4 × 3 = 60 combinations. Repeating the search across 4 session windows and 3 pairs creates 720 combinations. Reporting only the winning line hides how many chances there were to fit noise. These counts illustrate search breadth, not a statistical correction or an approved optimization plan.

Look for a reasoned, stable region of behaviour rather than a single spectacular parameter point. Stability is not proof either: a family can share the same data flaw or optimistic fill assumption. Record poor candidates and failures as well as successes. If a small cost change destroys the result, investigate the economic dependence rather than optimizing harder to restore the original profit factor.

A walk-forward procedure repeatedly develops on earlier data and evaluates on later data under a predefined schedule. It still needs disciplined feature availability, cost accounting and reporting of all segments. Do not merge only the profitable windows. After choosing the process, reserve genuinely new evidence; a final period that has already influenced the settings cannot become untouched again by renaming it.

14. Forward validation checks a different layer of evidence

Forward observation asks whether the frozen rules, data handling and operational controls behave as expected as new quotes arrive. Start by reconciling signals, skips, requested orders, fills and charges. Compare the same symbol specification, session mapping and volume assumptions used in the research. A demo can test much of the process without proving that live liquidity or execution will be identical.

Use a written protocol for disconnects, stale quotes, rejected modifications and uncertain order status. Predefine pause conditions and how existing positions are handled. A VPS can improve continuity but cannot guarantee fills. Keep financial risk decisions separate from a desire to complete a sample quickly; increasing size to obtain a more impressive result changes the evidence and the potential loss.

Evaluate rule fidelity and execution differences alongside net outcomes and equity drawdown. A short profitable run can be chance, and a short losing run does not by itself identify the cause. Do not rewrite the method after each outcome while calling the exercise forward validation. The forward-validation protocol provides a structured way to document observations and decisions.

15. A practical readiness review before trusting a report

Check the frozen rules and version, data provenance and coverage, signal availability, executable quote sides, intrabar exit ordering and complete charges. Then check cost stresses, position sizing, order-state handling and chronological separation. Each item should point to evidence, not a tick in a marketing checklist. A high modelling percentage cannot replace a missing piece of the execution chain.

If an assumption is unsupported, identify its effect and classify the conclusion accordingly. A data gap may leave a result unresolved; a double-counted fee may require recalculation; a look-ahead signal may invalidate the test entirely. Do not conceal these different outcomes under one quality score. Preserve the original run and issue a new version when a correction changes the method or its output.

After a forward run, reconcile decisions and the broker record before treating a summary as complete. The trade-reconciliation guide explains how to track discrepancies and unresolved states. A skipped or rejected opportunity belongs in the audit trail even when no trade appears in the performance report. Passing operational checks is a prerequisite for interpretation, not proof of profitability.

Review rules, data, timing, executable prices, complete costs and new evidence. An unsupported link can leave a test unresolved or invalid.
Review rules, data, timing, executable prices, complete costs and new evidence. An unsupported link can leave a test unresolved or invalid. On small screens, scroll the diagram horizontally.

16. What to keep in the final evidence pack

Save the original report, input settings, EA version, data identifiers, date range, symbol and account specifications, timezone assumptions, cost conventions and the test procedure. Keep a decision log that links signals to requests, fills, exits and booked charges. Include errors, ambiguous bars, rejected opportunities and open exposure. A reviewer should be able to reproduce the analysis and understand exactly which conditions remain hypothetical.

State results in the account currency, with consistent after-charge definitions and the number of completed outcomes. Show both balance and equity behaviour where available, drawdown, concentration and sensitivity to costs. Explain any difference between a platform metric and a separately reconciled metric. Keep deposits, withdrawals and other non-trading balance adjustments separate from trading profit. If volume changes between runs, disclose that change before comparing cash results or drawdown; more money earned with more exposure is not automatically a better method. Educational arithmetic should remain labelled as such and should never be displayed as verified trading history.

A defensible conclusion can be that the method deserves another test, that execution assumptions are too uncertain, or that the idea fails under the stated conditions. None requires inventing a winning system. Before advancing to a particular scalping strategy, you should know when its information exists, which quote can execute it and what evidence would make you reject the backtest rather than explain away its weaknesses.

Frequently asked questions

Does MT4 Every tick mean recorded real ticks?

Not by itself. Standard MT4 Every tick can interpolate intrabar changes from lower-timeframe bar data. Identify the actual data source and replay workflow, including Bid/Ask and spread handling. A mode label or modelling-quality percentage is not proof of recorded two-sided quotes or realistic fills.

Can a closed-bar strategy be validated with Open prices only?

A suitable bar-opening test may help check entry logic, but scalping exits, stops and targets can depend on the intrabar path. Closed-bar entry alone does not validate those decisions. Use adequate ordered evidence and disclose assumptions when the sequence cannot be resolved.

What if a candle touches both stop and target?

OHLC alone does not determine which came first. Use ordered quote evidence where available; otherwise flag ambiguity and disclose sensitivity or a stated convention. A stop-first assumption is not a reconstructed historical fact, and automatically selecting the target is not a defensible solution.

Should spread be deducted again from actual-fill profit?

No. Actual entry and exit prices already reflect spread and realised execution deviations. Include separately booked commission and financing where applicable without double counting. In MQL4, OrderProfit() excludes swap and commission, so reconcile the complete signed cash ledger.

Does Sleep() simulate broker latency in the MT4 tester?

No. Sleep() does not cause a delay in the standard Strategy Tester. A relevant delay scenario needs a documented method operating on the quote sequence, with missed fills and order states considered. It remains a simulation assumption rather than evidence of a broker’s historical latency.

How many trades make a scalping backtest reliable?

There is no universal number. Data quality, independent market episodes, costs, search breadth, untouched historical evidence and forward behaviour all matter. Nearby trades can be dependent. The fictional counts in this guide teach reconciliation and arithmetic; they do not establish a minimum sample or profitability.

Sources and testing notes

The official MetaQuotes references document standard MT4 modelling and tester-runtime limitations. Additional platform references were checked for quote sides, time-series indexing and profit-field accounting. The examples, prices, event counts and cash outcomes here are original fictional teaching material, not an executed backtest. Any separate tick-data or delay workflow requires its own documented verification.

Educational content. All numerical examples, prices, counts and outcomes are fictional, not verified trading results. Forex trading involves risk. A backtest, stop or planning budget does not guarantee future performance or a maximum loss.