Loading live market prices…

Forex Trading · lesson 29 of 33

Building a Strategy and Testing It Explained

4 min readBy the Pajama Markets team

Learn this in a 5-minute interactive lesson

Real charts and practice questions. Free, no sign-up needed.

Start lesson 29

What a strategy actually is

A strategy is a set of rules clear enough that someone else could follow them and take the same trades as you. "I buy when it looks good" isn't a strategy. It's a mood. A complete strategy defines:

  1. 1.Markets: which pairs you trade.
  2. 2.Timeframes: which charts you use for direction, area, and trigger.
  3. 3.Setup: the conditions that must be true before you even consider a trade.
  4. 4.Trigger: the exact signal that gets you in.
  5. 5.Stop loss: where it goes, every time.
  6. 6.Target: where you take profit, and the minimum reward-to-risk you'll accept.
  7. 7.Risk: how much you risk per trade.
  8. 8.Management: what you do while the trade is open, if anything.
  9. 9.No-trade rules: when you stay out, such as around big news.

A sample strategy: the trend pullback

Here's a simple strategy built from Part III. It isn't magic, and it isn't the only way to trade, but it's a sensible place to start because every rule has a reason. Chapter 32 follows a real-looking trade through it from start to finish.

Key idea
The trend-pullback strategy

Markets: EUR/USD, GBP/USD, USD/JPY.

Direction (daily chart): trade only in the direction of the daily trend. Buys need higher highs and higher lows; sells need lower highs and lower lows. If it's a range, don't trade.

Area (4-hour chart): wait for a pullback into an area with at least two of the following: a support or resistance zone (ideally one that has flipped roles), the 50–61.8% Fibonacci retracement of the last swing, the 50 EMA, a trendline.

Trigger (1-hour chart): a bullish engulfing pattern or hammer for buys (bearish engulfing or shooting star for sells) that closes back out of the area in the trend's direction.

Entry: at the close of the trigger candle.

Stop loss: beyond the pullback's extreme, plus a 10 to 15 pip buffer.

Target: just before the next 4-hour or daily swing high (for buys) or low (for sells). If the target is less than 1.5 times the stop distance, skip the trade.

Risk: 1 percent per trade, sized with the Chapter 28 formula. No more than two open trades, and never two trades on the same idea.

No-trade rules: no new trades in the 30 minutes before high-impact news on either currency; no new trades on Friday after 18:00 UTC; no trades after two losses in a day.

Management: leave the stop and target alone. If neither has been hit after seven trading days, close the trade.

Backtesting: trying it on the past

Backtesting means going back through old charts and applying your rules exactly as written, as if you were seeing each candle for the first time, and recording every trade the rules would have taken.

Step by step
A simple manual backtest
  1. 1.Choose one pair and go back at least six months, ideally a year or more.
  2. 2.On TradingView, use Bar Replay to hide future candles. In MetaTrader, you can use the Strategy Tester in visual mode, or just scroll slowly and cover the right side of the screen.
  3. 3.Move forward one candle at a time. Every time the rules say "trade," record the date, direction, entry, stop, target, and result in R.
  4. 4.Take every valid trade, including the ones you don't like the look of. Skipping trades is how backtests lie.
  5. 5.Keep going until you have at least 50 trades, and preferably 100.
  6. 6.Work out the win rate, average win, average loss, expectancy, longest losing streak, and biggest drawdown.
Worked example
Reading a backtest

A hypothetical backtest of the trend-pullback strategy on EUR/USD finds 60 trades: 25 winners averaging +1.9R and 35 losers averaging −1R.

Win rate: 25 ÷ 60 = 41.7%. Expectancy: (0.417 × 1.9) − (0.583 × 1) = 0.792 − 0.583 = +0.21R per trade. Longest losing streak: 6 trades. Biggest drawdown: 9R.

At 1 percent risk, a 9R drawdown means falling about 9 percent from a high at some point. If that would make you quit, you need to know now, not halfway through a live drawdown.

Forward testing: trying it in real time

Forward testing means trading the strategy on a demo account, in real time, for weeks, following every rule. It shows you things a backtest can't: whether you actually spot the setups while they're happening, whether you're awake when they appear, how slippage and spreads affect you, and whether you can stick to the rules when they're boring. Aim for at least 30 to 50 forward-test trades before going live.

Testing traps

  • Curve fitting. If you keep tweaking a strategy until it fits the past perfectly ("only trade on Tuesdays when RSI is 47"), you'll end up with rules that describe old charts beautifully and the future terribly. Keep the rules simple and the settings standard.
  • Small samples. Ten trades proves nothing. Even a coin can land heads seven times out of ten.
  • Hindsight. It's easy to see the "obvious" setup when you already know what happened next. Bar replay helps, but be honest.
  • Ignoring costs. Include spreads and commissions, especially for short-term strategies.
Myth buster
"If I buy a robot, I won't need any of this."

Automated trading programs, called Expert Advisors (EAs) in MetaTrader, can follow rules without emotions, which is genuinely useful. But a robot that's sold online with promises of "100% a month" and a screenshot of a perfect equity curve is almost always either curve-fitted to the past or a scam. If it really printed money, the seller wouldn't need your $299.

Key terms from this lesson

Strategy
a complete set of written rules for finding, entering, managing, and exiting trades.
Setup
the conditions that must be in place before a trade is considered.
Backtesting
applying a strategy's rules to past price data.
Forward testing
applying a strategy's rules in real time, usually on a demo account.
Curve fitting
over-adjusting a strategy so it matches past data but fails on new data.
Expert Advisor (EA)
an automated trading program for MetaTrader.
Full trading glossary →

Learn this in a 5-minute interactive lesson

Real charts and practice questions. Free, no sign-up needed.

Start lesson 29

Related guides

Pajama Markets provides education, not financial advice. Trading forex, crypto and leveraged products carries a high risk of losing money. Practise on a demo account first.