<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Apurv Kaushal</title>
    <description>The latest articles on DEV Community by Apurv Kaushal (@apurv_kaushal_b6764a01ddb).</description>
    <link>https://dev.to/apurv_kaushal_b6764a01ddb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4259700%2F17465370-ef42-4af0-a10b-ed4aabfa80c1.png</url>
      <title>DEV Community: Apurv Kaushal</title>
      <link>https://dev.to/apurv_kaushal_b6764a01ddb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/apurv_kaushal_b6764a01ddb"/>
    <language>en</language>
    <item>
      <title>We backtested 16 popular gold trading setups with costs. Most lost money.</title>
      <dc:creator>Apurv Kaushal</dc:creator>
      <pubDate>Mon, 23 Nov 2026 04:57:37 +0000</pubDate>
      <link>https://dev.to/apurv_kaushal_b6764a01ddb/we-backtested-16-popular-gold-trading-setups-with-costs-most-lost-money-4p4p</link>
      <guid>https://dev.to/apurv_kaushal_b6764a01ddb/we-backtested-16-popular-gold-trading-setups-with-costs-most-lost-money-4p4p</guid>
      <description>&lt;p&gt;Trading forums are full of setups with confident names: fair value gap, order block, MACD crossover, ICT silver bullet. We wanted to know what happens when you code them exactly as written and run them on gold (XAUUSD) with real trading costs.&lt;/p&gt;

&lt;p&gt;So we built a backtest for 16 of them. This post covers how it works, how we checked it, and what came out.&lt;/p&gt;

&lt;p&gt;Short version: most of them lost money after costs, and the main reason was stop size.&lt;/p&gt;

&lt;h2&gt;
  
  
  One unit first: R
&lt;/h2&gt;

&lt;p&gt;Results are in R, which is the result as a multiple of the amount risked. A trade that hits its stop is −1R. A trade that hits a target of 2x the risk is +2R. An average of −0.11R means each trade gave back about a tenth of what it risked.&lt;/p&gt;

&lt;p&gt;R is handy for comparing setups, because it doesn't care about position size or account size.&lt;/p&gt;

&lt;h2&gt;
  
  
  The data
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instrument:&lt;/strong&gt; gold, XAUUSD only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Candles:&lt;/strong&gt; 1-minute candles from an institutional price feed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Period:&lt;/strong&gt; July 2021 to November 2026, a little over five years.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gaps:&lt;/strong&gt; weekends and gaps in the data never count as part of a setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each setup's signal is built on 5-minute candles. Entries and exits are then checked on the 1-minute candles underneath, which gives a much finer view of what price did inside each 5-minute bar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing the rules down
&lt;/h2&gt;

&lt;p&gt;Every setup starts as a "textbook" version, written from the public definitions you'd find in a tutorial. Where a tutorial left something out, we used the most common public choice and wrote it down. The MACD crossover is a good example. The classic signal has no stop at all, so we used the lowest low since the previous opposite cross (the highest high for shorts).&lt;/p&gt;

&lt;p&gt;All textbook versions share a few things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;target at 2x the risk&lt;/li&gt;
&lt;li&gt;closed after 4 hours if neither the stop nor the target is hit&lt;/li&gt;
&lt;li&gt;shorts are the mirror image of longs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then each setup got 10 to 13 variations. Each variation changes one rule and keeps everything else the same: a different chart (1-minute, 15-minute, 1-hour), a different target, a trend filter, or a minimum stop size. That's 196 variations in total, and every one with 30 or more trades is published, losers included.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fills: how an order becomes a trade
&lt;/h2&gt;

&lt;p&gt;This is where a lot of backtests get too kind to themselves. We used three order types, depending on what the setup describes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Order type&lt;/th&gt;
&lt;th&gt;How it fills in the backtest&lt;/th&gt;
&lt;th&gt;Used by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Market&lt;/td&gt;
&lt;td&gt;at the open of the next 1-minute candle after the setup forms&lt;/td&gt;
&lt;td&gt;11 setups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Limit&lt;/td&gt;
&lt;td&gt;the first minute price touches the level&lt;/td&gt;
&lt;td&gt;4 setups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stop&lt;/td&gt;
&lt;td&gt;the first minute price touches the level&lt;/td&gt;
&lt;td&gt;1 setup&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two honest caveats. A limit order that is only touched may not fill in a live market, so the limit results are a best case. And a market order at the next open still assumes you were watching at that moment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exits: the same-candle problem
&lt;/h2&gt;

&lt;p&gt;A 1-minute candle tells you its high and low, but not the order they happened in. If one minute touches both the stop and the target, you can't tell which came first.&lt;/p&gt;

&lt;p&gt;We always count the stop in that case. It makes the results a little worse than reality on average, which is the side we'd rather be wrong on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Costs
&lt;/h2&gt;

&lt;p&gt;Every trade is measured twice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Before costs:&lt;/strong&gt; as if trading were free. No spread, no commission, no slippage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After costs:&lt;/strong&gt; a 0.004% fee and 0.002% slippage on each side of the trade, close to what a raw-spread gold account pays.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since the cost is a percentage of price and the result is in R, the cost per trade in R depends on how far away the stop is. A cost of a few tens of cents is small next to a $10 stop and huge next to a $1 stop. That turned out to be the most important line in the whole project.&lt;/p&gt;

&lt;p&gt;Funding costs and taxes are not included.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking it
&lt;/h2&gt;

&lt;p&gt;Two checks run before any number gets published.&lt;/p&gt;

&lt;h3&gt;
  
  
  Split periods
&lt;/h3&gt;

&lt;p&gt;Every result is split into 2021 to 2024 and 2025 to 2026. If both halves point the same way, it's probably not one strange year. If they disagree, the setup is labelled "unproven", even if the total is positive.&lt;/p&gt;

&lt;h3&gt;
  
  
  An independent recount
&lt;/h3&gt;

&lt;p&gt;We pick 20 random trades and re-count them with separate code. Those 20 matched. Every number on the results page comes from one checked file, so a table can't drift away from the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The results
&lt;/h2&gt;

&lt;p&gt;Textbook rules, 5-minute charts, July 2021 to November 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strategy&lt;/th&gt;
&lt;th&gt;Trades&lt;/th&gt;
&lt;th&gt;Before costs&lt;/th&gt;
&lt;th&gt;After costs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Asian range breakout&lt;/td&gt;
&lt;td&gt;1,091&lt;/td&gt;
&lt;td&gt;+0.04R&lt;/td&gt;
&lt;td&gt;+0.02R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;London breakout&lt;/td&gt;
&lt;td&gt;895&lt;/td&gt;
&lt;td&gt;−0.01R&lt;/td&gt;
&lt;td&gt;−0.04R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supertrend flip (textbook)&lt;/td&gt;
&lt;td&gt;9,902&lt;/td&gt;
&lt;td&gt;−0.01R&lt;/td&gt;
&lt;td&gt;−0.07R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RSI divergence (textbook)&lt;/td&gt;
&lt;td&gt;3,552&lt;/td&gt;
&lt;td&gt;−0.03R&lt;/td&gt;
&lt;td&gt;−0.10R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MACD crossover (textbook)&lt;/td&gt;
&lt;td&gt;30,414&lt;/td&gt;
&lt;td&gt;0.00R&lt;/td&gt;
&lt;td&gt;−0.11R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inside bar breakout&lt;/td&gt;
&lt;td&gt;37,198&lt;/td&gt;
&lt;td&gt;−0.01R&lt;/td&gt;
&lt;td&gt;−0.13R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fibonacci retracement 61.8% (textbook)&lt;/td&gt;
&lt;td&gt;16,478&lt;/td&gt;
&lt;td&gt;−0.02R&lt;/td&gt;
&lt;td&gt;−0.17R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Engulfing candle (textbook)&lt;/td&gt;
&lt;td&gt;33,316&lt;/td&gt;
&lt;td&gt;0.00R&lt;/td&gt;
&lt;td&gt;−0.22R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fair value gap (textbook)&lt;/td&gt;
&lt;td&gt;66,676&lt;/td&gt;
&lt;td&gt;−0.01R&lt;/td&gt;
&lt;td&gt;−0.22R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ichimoku cloud breakout (textbook)&lt;/td&gt;
&lt;td&gt;9,601&lt;/td&gt;
&lt;td&gt;0.00R&lt;/td&gt;
&lt;td&gt;−0.25R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Order block (textbook)&lt;/td&gt;
&lt;td&gt;18,818&lt;/td&gt;
&lt;td&gt;−0.02R&lt;/td&gt;
&lt;td&gt;−0.27R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Liquidity sweep (textbook)&lt;/td&gt;
&lt;td&gt;552&lt;/td&gt;
&lt;td&gt;−0.08R&lt;/td&gt;
&lt;td&gt;−0.44R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Break and retest (textbook)&lt;/td&gt;
&lt;td&gt;11,011&lt;/td&gt;
&lt;td&gt;−0.04R&lt;/td&gt;
&lt;td&gt;−0.52R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bollinger band bounce (textbook)&lt;/td&gt;
&lt;td&gt;21,967&lt;/td&gt;
&lt;td&gt;−0.03R&lt;/td&gt;
&lt;td&gt;−0.54R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;200 EMA bounce (textbook)&lt;/td&gt;
&lt;td&gt;2,376&lt;/td&gt;
&lt;td&gt;−0.04R&lt;/td&gt;
&lt;td&gt;−0.57R&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ICT silver bullet (textbook), unproven: the two test periods disagree&lt;/td&gt;
&lt;td&gt;274&lt;/td&gt;
&lt;td&gt;+0.13R&lt;/td&gt;
&lt;td&gt;+0.07R&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's 264,121 trades in all.&lt;/p&gt;

&lt;p&gt;Before costs, almost everything sits near zero. After costs, most setups drop well below it. Two end above zero, both by a small amount. The Asian range breakout made +0.02R. The ICT silver bullet made +0.07R, but it lost in 2021 to 2024 (−0.05R a trade) and gained only in 2025 to 2026 (+0.26R), so the split check marks it unproven.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the data said about stop size
&lt;/h2&gt;

&lt;p&gt;Line the setups up by their typical stop distance and the pattern jumps out. The 200 EMA bounce had a typical stop of $0.95, and costs took about 0.53R of every trade. The Asian range breakout had a typical stop of $13.07, and costs took about 0.02R.&lt;/p&gt;

&lt;p&gt;Our variations confirm it. For the break and retest, skipping trades with a stop under 10% of the typical daily move (the average daily range over the last 14 days) moved the result from −0.52R to −0.04R. It cut the trade count from 11,011 to 540 along the way.&lt;/p&gt;

&lt;p&gt;If you build your own backtests, the takeaways are cheap to apply:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Always run at zero cost and at real cost, and look at the gap.&lt;/li&gt;
&lt;li&gt;Record the stop distance in price terms for every trade.&lt;/li&gt;
&lt;li&gt;Decide in advance which way you'll resolve a candle that hits both stop and target.&lt;/li&gt;
&lt;li&gt;Split your data in time and expect both halves to agree.&lt;/li&gt;
&lt;li&gt;Re-count a random sample of trades with code you didn't reuse.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The full results, all 196 variations and the month-by-month numbers are open data (CC BY 4.0): &lt;a href="https://github.com/apurv-wicko/gold-strategy-tests" rel="noopener noreferrer"&gt;https://github.com/apurv-wicko/gold-strategy-tests&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are past results on historical data. They don't promise future results, and none of this is trading advice.&lt;/p&gt;

&lt;p&gt;Tested by Wicko's strategy lab: &lt;a href="https://wicko.ai/strategies/" rel="noopener noreferrer"&gt;https://wicko.ai/strategies/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>backtesting</category>
      <category>python</category>
      <category>trading</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
