Strategies we backtested higher highs and higher lows strategy

Tested by BacktestingMax

Higher highs and higher lows (market structure) backtest

Does trading higher highs and higher lows make money?

Mostly no. We backtested the standard rules on 10 markets, each on 15-minute, 1-hour and 4-hour charts, from 2020 to 2025, after trading costs. 9 out of 30 backtests made money. Only 3 made money in both 2020–2023 and 2024–2025. On gold, the account grew 306% on 1-hour charts and 40% on 4-hour charts. On the DAX 4-hour chart, the account grew 62%. On 15-minute charts, only 1 out of 10 markets made money. In an uptrend, each peak and each dip on the chart is higher than the one before. The standard rules buy after a new higher low, when a candle closes above the high of the candle that made that low. The stop-loss goes at the higher low, and the trade closes when a lower low forms. In a downtrend, the strategy sells after a new lower high instead. We also tested the idea behind the strategy: after a higher low, price goes on up. In 56.8% of 31,661 trades, price got back to the last peak before the stop-loss (for a sell, to the last dip). A price moving at random would do that 57.4% of the time. So a higher low did not make price more likely to keep rising.

30 backtests 2020–2025 Trading costs included Tested 9 November 2026

Where it worked 30 backtests
Made money
9
of 30 tests, with the standard rules
Made money in both periods
3
2020–2023 and again 2024–2025
Best backtest
+306%
Gold, 1-hour chart: account growth 2020–2025
With a take-profit at twice the risk
4
tests made money in both periods, compared with 3 with the standard rules

Made money in both periods

  • Gold, 1-hour
  • Gold, 4-hour
  • DAX, 4-hour

The results

Results on every market

Each box shows one backtest of the higher highs and higher lows strategy with the standard rules, from 2020 to 2025, after trading costs: the % result, and a small chart of the account balance. The solid line is the account balance and the dashed line is the starting balance. Green results made money; red results lost money. Under each result: whether it made money in both 2020–2023 and 2024–2025, or passed all four of our checks (see "How a test passes" further down).

Market 15-minute 1-hour 4-hour
EUR/USD −99% Lost money. Account down 90% by Jan 2023 −71% Lost money −8% Lost money
GBP/USD −99% Lost money. Account down 90% by Dec 2021 +45% Made money overall, lost in one period −11% Lost money
USD/JPY −81% Lost money. Account down 90% by Sept 2023 +86% Made money overall, lost in one period +29% Made money overall, lost in one period
Gold −97% Lost money. Account down 90% by Oct 2022 +306% Made money in both periods +40% Made money in both periods
Silver −99% Lost money. Account down 90% by Mar 2021 −80% Lost money −5% Lost money
Nasdaq 100 −66% Lost money −12% Lost money −3% Lost money
S&P 500 −88% Lost money +26% Made money overall, lost in one period −5% Lost money
Dow Jones −88% Lost money +3% Made money overall, lost in one period −9% Lost money
DAX +25% Made money overall, lost in one period −44% Lost money +62% Passed all four checks
FTSE 100 −99% Lost money. Account down 90% by Oct 2022 −80% Lost money −27% Lost money
All the numbers, test by test
Market Chart Trades Win rate Profit factor Result Max drawdown 2020–2023 2024–2025 Monte Carlo drawdown Trading costs
EUR/USD 15-minute 3,585 28.2% 0.80 −98.7% −98.8% −93.4% −80.2% −99.2% $6,285
EUR/USD 1-hour 929 28.1% 0.86 −71.1% −79.3% −36.4% −54.5% −81.7% $3,309
EUR/USD 4-hour 228 31.6% 0.94 −7.8% −20.2% +3.5% −10.9% −34.9% $366
GBP/USD 15-minute 2,753 25.5% 0.78 −99.3% −99.5% −99.1% −28.0% −99.6% $5,723
GBP/USD 1-hour 913 30.8% 1.07 +44.8% −42.2% −5.6% +53.4% −59.1% $4,708
GBP/USD 4-hour 214 34.1% 0.91 −10.5% −19.7% −8.4% −2.3% −32.3% $352
USD/JPY 15-minute 3,662 29.9% 0.89 −81.2% −94.0% −86.8% +42.2% −95.0% $10,374
USD/JPY 1-hour 919 33.2% 1.09 +85.9% −32.6% +87.9% −1.0% −51.0% $5,074
USD/JPY 4-hour 229 28.8% 1.14 +28.5% −21.2% +55.0% −17.1% −34.0% $469
Gold 15-minute 2,774 27.5% 0.86 −96.9% −98.0% −94.6% −42.9% −98.5% $9,195
Gold 1-hour 850 32.6% 1.24 +306.1% −44.2% +130.6% +76.1% −43.4% $7,968
Gold 4-hour 234 34.6% 1.27 +40.3% −12.6% +31.0% +7.1% −24.3% $482
Silver 15-minute 1,253 22.2% 0.59 −98.7% −98.7% −98.5% −9.5% −99.0% $8,098
Silver 1-hour 852 25.6% 0.72 −80.2% −81.7% −73.8% −24.5% −86.4% $4,522
Silver 4-hour 231 30.7% 0.96 −4.7% −26.1% −7.0% +2.5% −32.5% $962
Nasdaq 100 15-minute 3,467 28.4% 0.95 −66.0% −76.7% −58.5% −18.1% −92.5% $10,813
Nasdaq 100 1-hour 871 26.6% 0.98 −12.1% −46.8% −16.1% +4.8% −67.4% $2,151
Nasdaq 100 4-hour 226 36.3% 0.97 −2.9% −20.5% −1.1% −1.8% −28.0% $178
S&P 500 15-minute 3,416 28.9% 0.94 −87.6% −90.2% −65.4% −64.1% −96.3% $12,589
S&P 500 1-hour 885 29.3% 1.03 +26.0% −40.8% +33.8% −5.8% −59.6% $3,334
S&P 500 4-hour 227 34.8% 0.96 −4.9% −19.2% +0.1% −5.0% −32.4% $225
Dow Jones 15-minute 3,449 27.9% 0.96 −88.1% −95.6% −65.7% −65.3% −96.3% $13,802
Dow Jones 1-hour 880 28.5% 1.01 +3.2% −54.4% −20.0% +28.9% −61.7% $1,610
Dow Jones 4-hour 235 30.6% 0.92 −8.9% −26.8% −1.8% −7.2% −34.8% $145
DAX 15-minute 3,487 31.3% 1.01 +25.2% −66.0% −43.2% +120.6% −84.6% $10,587
DAX 1-hour 889 29.7% 0.91 −44.2% −56.1% −23.2% −27.3% −69.9% $1,226
DAX 4-hour 216 37.5% 1.48 +62.2% −8.3% +17.0% +38.6% −20.5% $161
FTSE 100 15-minute 3,248 27.3% 0.84 −99.0% −99.3% −95.8% −75.2% −99.5% $6,378
FTSE 100 1-hour 908 28.2% 0.77 −79.9% −85.8% −61.1% −48.2% −85.7% $1,879
FTSE 100 4-hour 241 29.5% 0.76 −27.1% −36.4% −22.9% −5.5% −41.8% $300

Profit factor is the money won divided by the money lost. Above 1 means the test made money. Max drawdown is the biggest fall from the highest balance. 2020–2023 and 2024–2025 show the result in each period on its own. Monte Carlo drawdown: we shuffled the trades into a random order 1,000 times; in 95% of those runs, the worst drawdown was this number or less. Result is the change in the account, with the risk of each trade set to 1% of the account at that time.

The account balance

The best test and the middle test

Best test Gold, 1-hour chart +306.1% from 2020 to 2025
Middle test (median): half of the 30 did better, half did worse GBP/USD, 4-hour chart −10.5% from 2020 to 2025

What we found

What the 30 backtests show

  1. With the standard rules, 3 backtests made money in both 2020–2023 and 2024–2025: gold on 1-hour and 4-hour charts, and the DAX on 4-hour charts. Only the DAX on 4-hour charts also passed all four of our checks. On this page, R is the amount a trade is set to risk: 1% of the account balance at the time. In those 3 backtests, buys made +237.6R and sells only +19.8R. Gold and the DAX both rose a lot from 2020 to 2025. On 15-minute charts, the higher low is close to the entry, so the spread is a big share of each trade. The average 15-minute trade made +0.006R before costs and lost 0.071R after.

  2. Does a higher low make price more likely to keep rising? To check, we took the 31,661 trades that had not yet passed the last swing point when they opened. For a buy, that is the last swing high, the most recent peak. For a sell, it is the last swing low. In 56.8% of these trades, price reached that swing point before it hit the stop-loss. A price moving at random would do that 57.4% of the time, from the same entry and stop-loss. The two numbers were close on all three charts. So in this test, the higher low gave no advantage. A take-profit at the last swing high would not have helped either. On the same trades, the average trade would have lost 0.016R before trading costs.

  3. Many smart money (SMC) traders only trade in the direction of the higher-timeframe trend: the trend on a longer chart. We tested that too, with the same swing-point rule on the longer chart. We used the 4-hour trend for 15-minute trades, and the daily trend for 1-hour and 4-hour trades. This filter kept about a third of the trades: 14,868 instead of 42,271. In 2024–2025, 14 out of 30 backtests made money with it, compared with 9 out of 30 with the standard rules. In 2020–2023, 7 out of 30 did, compared with 8 out of 30. So the filter did not clearly help. On 4-hour charts, the filter kept only 61 to 87 trades per backtest, too few to judge.

Does the trend continue?

Price reached the last swing point about as often as a random price would

For each trade, we checked which came first after the entry: the last swing high (for a sell, the last swing low) or the stop-loss. We used 1-minute prices. Standard rules, all 10 markets, 2020–2025.

Chart Trades checked Reached the swing point first A random price would
15-minute 23,638 57.0% 57.7%
1-hour 6,551 54.3% 54.9%
4-hour 1,472 64.9% 63.0%
All three charts 31,661 56.8% 57.4%

'A random price would' is the chance that a price moving up and down at random reaches the swing point before the stop-loss. It is the distance from the stop-loss to the entry, divided by the distance from the stop-loss to the swing point. For example, say the stop-loss is 10 points below the entry and the swing high 5 points above it. Then a random price reaches the swing high first 10 times out of 15: 67%. In 61.1% of these trades, the swing point was closer to the entry than the stop-loss was. That is why both numbers are above 50%. We worked this out for each trade, from the chart price at the entry without the spread, and show the average. When both prices came in the same minute (22 trades), we counted the stop-loss. We left out the 10,594 trades that opened with price already past the last swing point. On 4-hour charts, buys reached the swing high more often than a random price would (70.7%, compared with 65.4%, in 788 trades). Sells did so less often (58.2%, compared with 60.3%). Most of these markets rose from 2020 to 2025, which helps buys and hurts sells. Our random price does not rise or fall on average.

How the trades ended

6 trades in 10 hit the stop-loss at the higher low

Hit the stop-loss
61.6%
26,026 trades. On average, each lost 1.02R: a little more than 1R, because of trading costs
Closed when a lower low formed
38.4%
16,233 trades. On average, each made +1.50R, and 74.5% of them won

Standard rules, all 30 backtests: 42,271 trades, after trading costs. 12 more trades were still open at the end of 2025 and closed then. A lower low can close a buy only after price has made a newer higher low above the stop-loss. So the trade usually closes above its entry, and most of these trades won. On 4-hour charts, fewer trades hit the stop-loss: 55.4%. Most trades lose about 1R, so the strategy needs its fewer, bigger winners to pay for them.

Daily charts, more years

On daily charts, 7 out of 10 markets made money, but not much

Extra backtests with the standard rules, not part of the 30 above. Daily charts give only about 6 trades a year, so these backtests use more years. They run from 2007 to 2025 for currency pairs, gold and silver, and from 2014 to 2025 for the stock indices. After trading costs.

Market Trades Whole period Before 2020 2020–2025
EUR/USD 128 +14.4% +5.1% +8.9%
GBP/USD 122 +4.8% −6.8% +12.5%
USD/JPY 127 +15.1% +15.9% −0.7%
Gold 108 +19.8% +13.4% +5.6%
Silver 114 +6.1% +13.5% −6.5%
Nasdaq 100 70 +14.9% +2.3% +12.4%
S&P 500 79 −8.5% −11.1% +2.9%
Dow Jones 68 +4.6% +10.3% −5.2%
DAX 78 −27.0% −9.3% −19.5%
FTSE 100 84 −27.8% −18.1% −11.8%

'Before 2020' is 2007–2019 for currency pairs, gold and silver, and 2014–2019 for the indices. The best result, gold's +19.8% in 19 years, is about 1% a year. No daily backtest had more than 128 trades, and the indices had 68 to 84, fewer than the 100 our checks ask for. So luck can explain much of these results. The three changes did not make daily charts much better. With a take-profit at twice the risk, 6 out of 10 made money, and the best was the Nasdaq 100 (+25.2%). With the exit at the first close below the last higher low, 6 out of 10 made money, and the best was gold (+25.1%). With the higher-timeframe trend (the weekly chart's trend for daily trades), each backtest had only 16 to 51 trades.

The strategy

What the higher highs and higher lows strategy is

In an uptrend, each peak on the chart is higher than the one before it: a higher high. Each dip is also higher than the one before it: a higher low. A downtrend has lower highs and lower lows. This way of defining a trend is one of the oldest. It comes from Dow theory, which goes back to Charles Dow's writing around 1900. Traders who use smart money concepts (SMC) or the ICT (Inner Circle Trader) method call this pattern of highs and lows market structure. The standard rules we tested: in an uptrend, buy after a new higher low, put the stop-loss at that low, and close the trade when a lower low forms. To find the peaks and dips, we used swing points. A swing high is a candle whose high is above the highs of the 3 candles on each side of it. A swing low is a candle whose low is below the lows of the 3 candles on each side of it.

Swing points
3 candles on each side. We did not test other swing sizes
Stop-loss
At the higher low itself (for a sell, at the lower high), with no extra distance. It does not move
Take-profit
None with the standard rules: a lower low closes the trade. One of the changes under 'Can the higher highs and higher lows strategy be improved?' adds a take-profit
Risk per trade
Each trade is sized so that, if price goes from the signal candle's close to the stop-loss, the account loses 1% of its balance at the time. The account started at $10,000. The trade opens at the next candle's open, and its size is rounded down to a size the market allows. So the real risk can be a little more or less than 1%
Trading costs
The spread: the gap between the buy price and the sell price. Currency pairs: 0.8 pips on EUR/USD, 1.2 on GBP/USD and 0.9 on USD/JPY (a pip is 0.0001 on EUR/USD and GBP/USD, and 0.01 on USD/JPY). Metals: $0.30 on gold and $0.020 on silver. Stock indices: 1.5 points on the Nasdaq 100, 0.4 on the S&P 500, 2.0 on the Dow Jones, and 1.0 on the DAX and the FTSE 100. For silver, the Nasdaq 100, the Dow Jones, the DAX and the FTSE 100, we used wider spreads than our backtest engine's defaults, to match a typical retail broker. Our test treats chart prices as the middle between the buy price and the sell price. So a trade pays half the spread when it opens, and half when it closes at the stop-loss or at the market price. In the take-profit version, a take-profit fills at its own price and pays no spread. With a real broker, those winning trades would pay about half a spread more. There is no commission
Skipped trades
Sometimes a trade that risks 1% would be smaller than the smallest trade a market allows. The smallest trades are 1,000 units of a currency pair, 1 ounce of gold, 50 ounces of silver, or 0.1 of an index contract. The test then skips that trade. With the standard rules, the test skipped 99 trades on 1-hour and 4-hour charts. 85 of them were on silver, after its 1-hour account had lost more than half. On 15-minute charts, it skipped 155 trades while the account held more than $1,000. It skipped 7,347 more after accounts had lost 90%, because 1% of what was left was too small. Every backtest kept running after a 90% loss
Rounded trade sizes
Trade sizes are rounded down to a size step the market allows, so some trades risked less than 1%. On 1-hour and 4-hour charts, 1,587 trades (14%) risked less than 0.9%, most of them on silver and the stock indices
Largest trade size
A very close stop-loss can need a bigger trade than our backtest engine allows. The limit is 30 times the account balance on currency pairs, and 20 times on gold, silver and the indices. Then the trade uses the biggest size allowed and risks less than 1%. This happened in 189 trades, all on 15-minute charts
Overnight (swap) fees
Not included. Brokers charge (or sometimes pay) a fee for each night a trade stays open. Half of the trades closed within 3.6 hours on 15-minute charts, 14 hours on 1-hour charts and 3.4 days on 4-hour charts. On 4-hour charts, 75% of the trades stayed open longer than a day. On daily charts, half stayed open about 3 weeks or longer. So with a real broker, the 4-hour and daily results could be higher or lower
Price data
CFD prices: the prices a broker quotes for a CFD (contract for difference), the product most brokers outside the US offer for trading these markets. We built the candles from 1-minute prices. 4-hour and daily candles start at 17:00 New York time. The 1-minute prices also show whether the stop-loss or the take-profit came first inside a candle. Candles with no price movement (holidays in the data) are never swing points or signal candles. Neither are the tiny extra candles that a few minutes of prices after the Friday close make in some of our data

The rules we tested

  1. Find the swing points. A swing high is a candle whose high is higher than the highs of the 3 candles before it and the 3 candles after it. A swing low is a candle whose low is lower than the lows of the 3 candles on each side. A swing point is known only when the 3rd candle after it closes. That candle confirms it.
  2. Uptrend: the last swing high is higher than the one before it (a higher high). The last swing low is also higher than the one before it (a higher low). Downtrend: both are lower. If one rises and the other falls, there is no trend and no trade.
  3. Buy setup: a new higher low in an uptrend. Starting with the candle that confirms the higher low, wait for the first candle that closes above the high of the swing-low candle (the candle that made the higher low). That candle is the signal candle. Buy at the next candle's open.
  4. Put the stop-loss at the higher low itself: the low of the swing-low candle. The stop-loss does not move.
  5. Close the trade at the next candle's open when a lower low forms: a new swing low that is lower than the swing low before it. This can happen only after price has made a newer higher low above the stop-loss, and then a swing low below that one. There is no take-profit.
  6. Sells follow the same rules in a downtrend. After a new lower high, sell after the first close below the low of the swing-high candle. The stop-loss goes at the lower high, and the trade closes when a higher high forms.
  7. A buy setup is cancelled if price falls back to the higher low before the signal candle, if a newer swing low replaces it, or if the uptrend ends. Only one trade is open at a time. If the signal candle comes while a trade is open, that setup is not traded.
  8. Size every trade so that, if the stop-loss is hit, the trade loses 1% of the account.

The method

How we tested it

The test

Markets
EUR/USD, GBP/USD, USD/JPY, Gold, Silver, Nasdaq 100, S&P 500, Dow Jones, DAX and FTSE 100
Charts
15-minute, 1-hour and 4-hour candles
Dates
January 2020 to December 2025
Account
$10,000, risking 1% of the account on each trade
Trading costs
Included. Every trade pays that market's normal trading cost: the spread, which is the gap between the buy price and the sell price.

How a test passes

We call a test passed only if it meets all four checks. A strategy can make money in one backtest and still fail one of these checks.

  • At least 100 trades. With fewer trades, a good result could be luck.
  • It made money from 2020 to 2023 and again from 2024 to 2025. This shows whether the strategy kept working in the newer years, not only in the older ones.
  • A profit factor (the money won divided by the money lost) of at least 1.2 from 2024 to 2025, after trading costs.
  • In 95% of 1,000 random shuffles of the trades, the account must not fall more than 30% from its highest point.

Improvements

Can the higher highs and higher lows strategy be improved?

We tried three changes that traders often make, each as its own version on the same 30 backtests. The first adds a take-profit at twice the risk. The second closes the trade earlier, at the first close below the last higher low. The third adds a higher-timeframe trend filter. If you pick the best version on the same years you judge it on, it will often look better than it really is. So we picked the version that made money in the most backtests in 2020–2023 only. Then we checked it on 2024–2025, the years we did not use to pick it.

Version Made money 2020–2023years used to pick the best version Made money 2024–2025years not used to pick it Made money in both periods Passed all four checks
Standard rules The rules under 'The rules we tested': the stop-loss at the higher low, no take-profit, and the trade closes when a lower low forms. 8 of 30middle test −21.4% 9 of 30middle test −6.5% 3 1
With a take-profit at twice the riskBest on 2020–2023 Close the trade when it has made twice what it would lose at the stop-loss (2R), measured from the close of the signal candle. A lower low no longer closes the trade. 12 of 30middle test −27.4% 11 of 30middle test −5.2% 4 2
Exit at the first close below the last higher low The trade also closes at the next candle's open after a candle closes below the most recent higher low (for a sell, above the most recent lower high). The trade does not wait for a lower low to form. 10 of 30middle test −24.6% 11 of 30middle test −8.7% 5 1
With the higher-timeframe trend Only buy when a longer chart is also in an uptrend by the same swing-point rule, and only sell when it is in a downtrend. The longer chart is the 4-hour chart for 15-minute trades, and the daily chart for 1-hour and 4-hour trades. 7 of 30middle test −18.5% 14 of 30middle test −1.4% 3 2

Not by much. In 2020–2023, the years we used to pick, the take-profit at twice the risk (2R) made money in the most backtests: 12 out of 30. The standard rules made money in 8 out of 30. In 2024–2025, the years we kept for the check, the gap was smaller: 11 out of 30, compared with 9 out of 30. With the 2R take-profit, 4 backtests made money in both periods (3 with the standard rules), and 2 passed all four checks (1 with the standard rules). But a fixed take-profit closes the biggest winning trades early. With the standard rules, gold's 10 best trades on 1-hour charts made $32,342, more than that backtest's whole profit of $30,607. With the 2R take-profit, that backtest made +126% instead of +306%. The exit at the first close below the last higher low made money in both periods in 5 backtests, the most of the four versions. The higher-timeframe trend made money in 14 out of 30 backtests in 2024–2025, the most of any version, but in only 7 out of 30 in 2020–2023. With every version, most of the 30 backtests lost money from 2020 to 2025.

Passed all four checks with a take-profit at twice the risk

  • Nasdaq 100, 4-hour
  • DAX, 4-hour

Questions

Questions traders ask

Does trading higher highs and higher lows (market structure) work?

Mostly no, in our backtest. We tested buying after a new higher low in an uptrend, with the stop-loss at that low, and selling after a new lower high in a downtrend. We ran it on 10 markets and 3 timeframes from 2020 to 2025, after trading costs. 9 out of 30 backtests made money. Only 3 made money in both 2020–2023 and 2024–2025: gold on 1-hour and 4-hour charts, and the DAX on 4-hour charts. On 15-minute charts, only 1 out of 10 markets made money.

Is a trend more likely to continue after a higher low?

Not in our test. After a new higher low, price got back to the last swing high (the most recent peak) before the stop-loss in 56.8% of 31,661 trades. Sells were checked the same way, after a lower high. A price moving at random would reach the swing point first 57.4% of the time, from the same entry and stop-loss. The two numbers were close on 15-minute, 1-hour and 4-hour charts. Before trading costs, the average trade made almost nothing: 1.4% of the amount it risked.

What is the best timeframe for trading higher highs and higher lows?

No timeframe worked on most markets in our test. 1-hour and 4-hour charts did better than 15-minute charts: 8 out of 20 backtests made money, compared with 1 out of 10. But even there, 12 out of 20 lost money. On 15-minute charts, the stop-loss at the higher low is close to the entry, so trading costs take a big share of each trade. On daily charts, 7 out of 10 markets made money, but slowly. The best was gold, with +19.8% from 2007 to 2025, about 1% a year.

Should you only trade with the higher-timeframe trend?

Our test does not show that it helps. We took trades only when a longer chart showed the same trend, by the same swing-point rule. That was the 4-hour chart for 15-minute trades, and the daily chart for 1-hour and 4-hour trades. In 2024–2025, 14 out of 30 backtests made money this way, compared with 9 out of 30 without the filter. In 2020–2023, 7 out of 30 did, compared with 8 out of 30. The filter also cut the number of trades to about a third.

Keep exploring

Related strategies we tested

ICT & smart money Change of character (CHoCH) and market structure shift (MSS) backtest Made money in 7 of 40 tests, 5 of them in both periods. Best: USD/JPY, 1-hour, +66% ICT & smart money Order block strategy backtest Made money in 5 of 30 tests, 2 of them in both periods. Best: USD/JPY, 4-hour, +29% ICT & smart money ICT New York killzone backtest on NQ and ES futures Made money in 4 of 10 tests, 1 of them in both periods. Best: MGC (Micro Gold), 15-minute, +36% ICT & smart money ICT Power of 3 (AMD) backtest on NQ, ES and gold futures Made money in 4 of 10 tests, 2 of them in both periods. Best: YM (Dow futures), 15-minute, +46% ICT & smart money ICT Silver Bullet backtest on NQ and ES futures Made money in 0 of 10 tests, 0 of them in both periods. Best: MGC (Micro Gold), 5-minute, −2% ICT & smart money Fair value gap (FVG) retest strategy backtest Made money in 5 of 24 tests, 2 of them in both periods. Best: S&P 500, 15-minute, +124%
The strategy code we ran

This is the exact code from the BacktestingMax strategy engine. Paste it into the strategy editor in the app to run it on any market.

class HigherHighsHigherLows(Strategy):
    """Higher highs and higher lows: trade with the trend that the swing points show (Dow
    theory, and "market structure" in smart money concepts), plus three common changes.
    Swing points. A swing high is a candle whose high is higher than the highs of the 3
    candles before it and the 3 candles after it, so it is known only 3 candles later. A
    swing low is the mirror image.
    Uptrend: the last two swing highs rise (a higher high) and the last two swing lows rise
    (a higher low). Downtrend: both fall.
    Standard (all switches off):
      1. A new swing low that is higher than the swing low before it, while the last two
         swing highs also rise, is a buy setup: a higher low in an uptrend.
      2. Buy at the next candle's open after the first candle, from the one that confirms
         the swing low onward, that closes above the high of the swing-low candle.
      3. Stop-loss at the higher low: the low of the swing-low candle.
      4. Close the trade at the next candle's open when a lower low forms: a new swing low
         below the swing low before it. No take-profit.
      5. Sells mirror it: a lower high in a downtrend, sell after the first close below the
         low of the swing-high candle, stop-loss at the lower high, close the trade when a
         higher high forms.
      6. A setup ends when price reaches its swing point, when a newer swing point of the
         same kind is confirmed, or when the trend no longer holds (a buy setup ends when a
         lower high is confirmed). One trade at a time: a setup that triggers while a trade
         is open is dropped.
      7. Size every trade so that the stop-loss costs 1% of the account, measured from the
         close of the signal candle.
    Skipped candles: flat candles (high = low: no price moved, e.g. a holiday in the data)
    and candles that open on a Friday at 17:00 New York time or later (a few minutes of
    prices after the weekly close in some index data). They are never swing points or
    signals.
    The changes, one at a time:
      target_r = 2  take profit at 2R, where R is the distance from the signal candle's
                    close to the stop-loss; a lower low (higher high) no longer closes it
      trail    = 1  also close the trade at the next open after a candle closes below the
                    most recent higher low (for a sell: above the most recent lower high),
                    without waiting for a lower low to form
      htf      = 1  only buy when the higher chart is in an uptrend by the same rule (its
                    last two swing highs and its last two swing lows rise), only sell when
                    it is in a downtrend. Higher chart: M15 -> H4, H1 -> D1, H4 -> D1,
                    D1 -> W1. A higher-chart candle is skipped when every chart candle in
                    it was.
    """
    params = {"swing_bars": Param(type=int, default=3, min=1, max=20),
              "target_r": Param(type=float, default=0.0, min=0.0, max=10.0),
              "trail": Param(type=int, default=0, min=0, max=1),
              "htf": Param(type=int, default=0, min=0, max=1)}
    lookback = 5
    higher_chart = {"M5": "H1", "M15": "H4", "M30": "H4", "H1": "D1", "H4": "D1", "D1": "W1"}
    def init(self, ctx):
        self.ny = ctx.clock("America/New_York")
        self.chart = {"win": [], "highs": [], "lows": []}   # swing points on the chart
        self.buy_setup = None    # a higher low in an uptrend: {"stop", "trigger"}
        self.sell_setup = None   # a lower high in a downtrend
        self.exit_level = None   # trail version: the most recent higher low (lower high)
        self.view = None
        if ctx.params.htf == 1:
            self.view = ctx.tf(self.higher_chart[ctx.timeframe])
            self.higher = {"win": [], "highs": [], "lows": []}
            self.view_seen = -1
            self.view_ms = self.view.timeframe_seconds * 1000
            self.counted = []    # open times of the last chart candles that were not skipped
    @staticmethod
    def add_candle(s, n, k, high, low):
        """Add one candle to a chart's swing points. Returns the swing high and the swing low
        it confirms (the candle n candles back), each as a dict or None. "level" is the swing
        price; "trigger" is the other end of that candle (its high for a swing low)."""
        win = s["win"]
        win.append((k, high, low))
        if len(win) > 2 * n + 1:
            win.pop(0)
        if len(win) < 2 * n + 1:
            return None, None
        ck, ch, cl = win[n]
        others = win[:n] + win[n + 1:]
        sh = {"bar": ck, "level": ch, "trigger": cl} if all(ch > x[1] for x in others) else None
        sl = {"bar": ck, "level": cl, "trigger": ch} if all(cl < x[2] for x in others) else None
        if sh is not None:
            s["highs"] = (s["highs"] + [sh])[-2:]
        if sl is not None:
            s["lows"] = (s["lows"] + [sl])[-2:]
        return sh, sl
    @staticmethod
    def trend(s):
        """+1 when the last two swing highs and the last two swing lows both rise, -1 when
        both fall, 0 otherwise."""
        hs, ls = s["highs"], s["lows"]
        if len(hs) < 2 or len(ls) < 2:
            return 0
        if hs[1]["level"] > hs[0]["level"] and ls[1]["level"] > ls[0]["level"]:
            return 1
        if hs[1]["level"] < hs[0]["level"] and ls[1]["level"] < ls[0]["level"]:
            return -1
        return 0
    def on_bar(self, ctx):
        p = ctx.params
        n = p.swing_bars
        h, l, c = ctx.high[0], ctx.low[0], ctx.close[0]
        after_close = (self.ny.weekday == 4 and self.ny.minute_of_day >= 17 * 60) or self.ny.weekday == 5
        counts = h > l and not after_close
        if self.view is not None:
            self.read_higher_chart(ctx, n, counts)
        if not counts:
            return
        s = self.chart
        sh, sl = self.add_candle(s, n, ctx.bar_index, h, l)
        hs, ls = s["highs"], s["lows"]
        lower_low = sl is not None and len(ls) == 2 and ls[1]["level"] < ls[0]["level"]
        higher_high = sh is not None and len(hs) == 2 and hs[1]["level"] > hs[0]["level"]
        trend = self.trend(s)
        # The open trade: a lower low (higher high) ends a buy (sell), unless the version
        # uses a fixed take-profit instead.
        pos = ctx.position
        if pos is not None:
            if pos.is_long:
                if sl is not None and self.exit_level is not None and sl["level"] > self.exit_level:
                    self.exit_level = sl["level"]          # a new higher low
                end = lower_low or (p.trail == 1 and self.exit_level is not None and c < self.exit_level)
            else:
                if sh is not None and self.exit_level is not None and sh["level"] < self.exit_level:
                    self.exit_level = sh["level"]          # a new lower high
                end = higher_high or (p.trail == 1 and self.exit_level is not None and c > self.exit_level)
            if p.target_r <= 0 and end:
                ctx.close_position()
        # Setups: each higher low (lower high) that a trend confirms, until it ends.
        if sl is not None:
            self.buy_setup = {"stop": sl["level"], "trigger": sl["trigger"]} if trend == 1 else None
        if sh is not None:
            self.sell_setup = {"stop": sh["level"], "trigger": sh["trigger"]} if trend == -1 else None
        if trend != 1:
            self.buy_setup = None
        if trend != -1:
            self.sell_setup = None
        if self.buy_setup is not None and l <= self.buy_setup["stop"]:
            self.buy_setup = None
        if self.sell_setup is not None and h >= self.sell_setup["stop"]:
            self.sell_setup = None
        # The signal: the first close beyond the other end of the setup's swing candle. Each
        # setup is used once; one that triggers while a trade is open is dropped.
        buy = self.buy_setup is not None and c > self.buy_setup["trigger"]
        sell = self.sell_setup is not None and c < self.sell_setup["trigger"]
        setup = self.buy_setup if buy else self.sell_setup if sell else None
        if buy:
            self.buy_setup = None
        if sell:
            self.sell_setup = None
        if ctx.position is not None:
            return
        if not ctx.gate("higher_low_or_lower_high_confirmed", setup is not None):
            return
        side = 1 if buy else -1
        if self.view is not None:
            if not ctx.gate("with_higher_chart_trend", self.trend(self.higher) == side):
                return
        stop = setup["stop"]
        size = ctx.size_by_risk_pct(0.01, stop=stop, entry=c)
        if not ctx.gate("size_at_least_the_minimum", size > 0):
            return
        tp = c + side * p.target_r * abs(c - stop) if p.target_r > 0 else None
        self.exit_level = stop
        if side > 0:
            ctx.buy(size=size, sl=stop, tp=tp, tag="higher_low_buy")
        else:
            ctx.sell(size=size, sl=stop, tp=tp, tag="lower_high_sell")
    def read_higher_chart(self, ctx, n, counts):
        """Feed each newly closed higher-chart candle into its own swing points."""
        if counts:
            self.counted = (self.counted + [ctx.bar_time])[-3:]
        v = self.view
        if v.bar_index < 0 or v.bar_index == self.view_seen:
            return
        self.view_seen = v.bar_index
        end = v.bar_time                     # the higher-chart candle's close time
        start = end - self.view_ms
        if not any(start <= t < end for t in self.counted):
            return                           # every chart candle in it was skipped
        if v.high[0] > v.low[0]:
            self.add_candle(self.higher, n, v.bar_index, v.high[0], v.low[0])

Your turn

Test the higher highs and higher lows strategy yourself

Change the settings, the market or the stop-loss and see the result in seconds. Ask the BacktestingMax AI: Backtest this on the DAX, 4-hour chart: swing points with 3 candles on each side. In an uptrend, buy after a candle closes above the high of the candle that made a new higher low. Stop-loss at the higher low, close the trade when a lower low forms, risk 1% per trade.

Try it free in BacktestingMax

Free account. No credit card needed.

See every strategy we tested Browse strategies shared by traders

Backtest on historical data with trading costs, run by BacktestingMax. Past results do not guarantee future results, and nothing here is financial advice. Updated 9 November 2026.