In this lesson
Eight lessons of results are only useful if you can repeat the method on the pattern you actually trade. This last lesson does that. It is the same method we used, reduced to what one trader can do with MetaTrader 5 and a spreadsheet in an evening.
Take the pattern you trust most, and follow the steps in order. Resist the urge to skip to the result. Each step exists because of a mistake from the earlier lessons.

Step 1: write the rule down
If the rule is not written, you will bend it when you look at the chart. Write every one of these:
- The shape. What exactly counts? For a candle, use numbers: the body is at most a tenth of the range, the wick is at least twice the body.
- What came before it. After a fall, after a rise, at a level, in a certain session.
- The direction. Buy, sell, or the way the price breaks out.
- The entry. At the next candle's open, or at a breakout level.
- The stop. A fixed place, such as beyond the pattern's far end.
- The target. 1:1, 1:2, or an exit time.
- A time limit. When a trade that has gone nowhere is closed.
- The market and timeframe.
Lesson 3 showed why this matters: the loose version of the hammer and the strict version gave opposite answers. Write the rule once, before you look at any result, and do not change it afterwards. If you change it, count it as a new test.
Step 2: get your broker's prices
Test on the prices you will trade on, since spreads and gaps differ between brokers.
Exporting candles from MetaTrader 5
Open View, then Symbols (or press Ctrl+U). Choose the Bars tab. Pick the symbol and the timeframe, set the start and end dates, and press Request. When the list loads, press Export Bars and save the CSV file. Open it in your spreadsheet.
Get at least two years if your broker has them. If the file has gaps, say so in your notes and do not guess.
Step 3: mark the signals
Put the open, high, low and close of each candle in columns, one candle per row. Then add a column that marks the pattern with a formula. For an inside bar, with highs in column C and lows in column D, the formula in row 3 is:
=AND(C3<C2, D3>D2)
Count the marked rows. If you have fewer than a hundred, stop here. No result on fewer trades is worth reading (lesson 8). Use a longer history, a lower timeframe or a second market.
Step 4: play each trade
For every signal, work out the entry, the stop and the target from your rule, and look at the following candles to see which was touched first. Write the result as +1 for a target, −1 for a stop, and 0 for a time-out.
One trade
A buy-the-breakout trade on EURUSD: the mother candle's high is 1.1050 and its low is 1.1010. You buy at 1.1050 and put the stop at 1.1010, so the risk is 40 pips. A 1:1 target is 40 pips away, at 1.1090.
When one candle touches both the stop and the target, the candle data cannot tell you which came first. Count it as a loss, the way we did. That keeps the test honest, and if you want better, check the 1-minute candles for those cases.
Step 5: take the cost off
Divide the spread by the stop distance. This is c from lesson 7.
In the example above, a spread of 0.4 pips is 1% of the 40-pip stop. Break-even is then (1 + c) / 2, or 50.5%. A simple way to apply it is to subtract c from the result of every winning trade and to add c to every loss. Use your broker's real spread, and add commission if it charges one.
Step 6: build the random control
A pattern's result means nothing alone. Build a control from random trades:
- Pick the same number of random candles as you have signals, three times over.
- Give each the same direction as the pattern and the same stop distance as a pattern trade.
- Play and cost them exactly like the real trades.
In a spreadsheet, use a random number column, then copy it and paste it as values, so the numbers stop changing every time you edit a cell. If the pattern cannot beat the random trades in the same direction, it adds nothing.
Step 7: split it and read it honestly
- Compute the win rate of the pattern and of the control.
- Compute the 95% range around the pattern's win rate. A quick approximation is the win rate plus or minus 1.96 × the square root of (win rate × (1 − win rate) / trades). The table in lesson 8 gives exact figures.
- Repeat for each year separately. A result that holds in only one year is a warning.
- Ask the five questions in lesson 8.
If the whole range sits above the control in both years, you have a candidate. If it does not, you have saved yourself the cost of finding out with real money.
Step 8: forward-test before you trust it
A backtest tells you how a rule would have done. To know how it does, trade it on a demo account with a tiny risk, and keep a journal: the setup, the planned stop and target, the result and a note. After a few dozen real trades, compare the journal with the backtest. If the forward results are far below the test, believe the forward results.
Strategy Tester
MetaTrader 5 has a Strategy Tester (Ctrl+R) that can run an Expert Advisor over history. If you code the rule as an EA, choose the model "Every tick based on real ticks" for the most accurate result, and set a realistic spread. The spreadsheet method is slower, but it forces you to see every trade.
Key takeaways
- Write the rule down in numbers before you look at any result, and do not change it afterwards.
- Test on your own broker's prices, with the spread taken off every trade.
- Count a candle that touches both stop and target as a loss.
- Compare with random trades in the same direction and with the same stop, and split the result by year.
- Fewer than a hundred trades cannot tell luck from edge. Forward-test on a demo before you trust a backtest.
Questions
How do I backtest a candlestick pattern?
Write the exact rule, export your broker's candles from MetaTrader 5, mark the signals in a spreadsheet, play each trade with a stop and a target, take the spread off, and compare the result with random trades that have the same direction and stop.
How many trades do I need?
At least a hundred, and the more the better. A win rate needs about 53.1% out of 1,000 trades before its whole range is above a coin flip.
How do I export candle data from MetaTrader 5?
Press Ctrl+U to open the Symbols window, choose the Bars tab, set the symbol, timeframe and dates, press Request, then Export Bars. The file is a CSV that a spreadsheet can open.
Why do I need random trades to compare with?
They show what the market and your costs give you without any pattern. A pattern only has value if it beats them.
Is a backtest enough to trade a pattern with real money?
No. Test on a demo account with a small risk first and keep a journal, so you can compare real results with the backtest.
Kairotick tool
Test your own patterns, not ours.
TradeWarden is an Expert Advisor for MetaTrader 5. Its journal keeps each trade's MAE and MFE, the setup and the note you set on the panel, and a chart picture from when it opened and when it closed, so you can see which of your setups really pay.
Trading carries a high risk of losing money. TradeWarden never opens trades on its own and does not promise a pass.
Candlestick patterns, tested
Educational content, not financial advice. Trading forex and CFDs carries a high risk of losing money. Examples use round numbers to show the method; check your own broker's contract specifications and your firm's rules.