<?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: Truong Pham | Moon The Train</title>
    <description>The latest articles on DEV Community by Truong Pham | Moon The Train (@moonthetrain).</description>
    <link>https://dev.to/moonthetrain</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%2F2405521%2F747d1db6-8a77-4447-b3f5-7608eb9acc39.png</url>
      <title>DEV Community: Truong Pham | Moon The Train</title>
      <link>https://dev.to/moonthetrain</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moonthetrain"/>
    <language>en</language>
    <item>
      <title>QuantDinger Jev Filter Backtest: 0 of 1,324</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Mon, 02 Nov 2026 06:37:46 +0000</pubDate>
      <link>https://dev.to/moonthetrain/quantdinger-jev-filter-backtest-0-of-1324-32l3</link>
      <guid>https://dev.to/moonthetrain/quantdinger-jev-filter-backtest-0-of-1324-32l3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Does QuantDinger's Jev filter help?&lt;/strong&gt; In my replay it never got the chance. With the platform's default settings, Jev's answers didn't clear the confidence bar once in 1,324 requests, so every trade went through exactly as if the filter were off. When I removed the thresholds and let Jev's own answers decide, it did no better than blocking trades at random.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I ran this
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;part 4&lt;/a&gt; I read QuantDinger's Jev gate and ended on a complaint: it only runs on live strategies, so nobody can backtest it. That wasn't quite true. The gate only needs a JSON state and six answers from Jev, and the &lt;a href="https://moonthetrain.com/lab/jev-does-not-remember-the-past" rel="noopener noreferrer"&gt;Polymarket memory test&lt;/a&gt; showed Jev doesn't recall how past events turned out. So I rebuilt the state for every historical signal, asked Jev, and applied QuantDinger's own rule to the answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I rebuilt the gate
&lt;/h2&gt;

&lt;p&gt;I didn't retype anything I could import. From QuantDinger at commit &lt;code&gt;96cec2d&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Piece&lt;/th&gt;
&lt;th&gt;Where it came from&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The six questions and their choices&lt;/td&gt;
&lt;td&gt;parsed straight out of &lt;code&gt;ai_decision_filter.py&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RSI, MACD, ATR, moving averages, support/resistance&lt;/td&gt;
&lt;td&gt;QuantDinger's own &lt;code&gt;technical_indicators.py&lt;/code&gt;, imported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Order budget&lt;/td&gt;
&lt;td&gt;their &lt;code&gt;order_budget.py&lt;/code&gt;, imported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The state sent to Jev&lt;/td&gt;
&lt;td&gt;a line-by-line copy of &lt;code&gt;ai_decision_context.py&lt;/code&gt;; the only change is that "now" is the signal's time, not today&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Answer checks and the pass rule&lt;/td&gt;
&lt;td&gt;a line-by-line copy of &lt;code&gt;_evaluate_jev()&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The request body is the same one the platform sends (&lt;code&gt;model&lt;/code&gt;, &lt;code&gt;state&lt;/code&gt;, &lt;code&gt;questions&lt;/code&gt;) to the same endpoint, with &lt;code&gt;jev-latest&lt;/code&gt;, which answered as &lt;strong&gt;jev-1.14.0&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The strategy is QuantDinger's official example, &lt;code&gt;strategy_v2_dual_ema_long.py&lt;/code&gt;: on every bar close, if the 20-bar average is above the 50-bar average, hold 95% of equity; if not, hold nothing; 5% stop loss. While it's flat in an uptrend it asks to enter on every bar, so a rejected entry gets asked again an hour later. Exits never go through the gate, same as the platform.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Data&lt;/th&gt;
&lt;th&gt;Period&lt;/th&gt;
&lt;th&gt;Trades without the gate&lt;/th&gt;
&lt;th&gt;Return&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BTC 1h&lt;/td&gt;
&lt;td&gt;Exness BTCUSD ticks, shown to Jev as &lt;code&gt;BTC/USDT&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;30 Apr 2024 – 11 Oct 2026&lt;/td&gt;
&lt;td&gt;246&lt;/td&gt;
&lt;td&gt;−20.7%&lt;/td&gt;
&lt;td&gt;−53.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gold 1h&lt;/td&gt;
&lt;td&gt;Exness XAUUSD ticks&lt;/td&gt;
&lt;td&gt;17 Jun 2020 – 5 Oct 2026&lt;/td&gt;
&lt;td&gt;416&lt;/td&gt;
&lt;td&gt;+96.2%&lt;/td&gt;
&lt;td&gt;−19.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Buys fill at the next bar's open plus the real spread, with 0.05% fees per side on BTC and 0.01% on gold. One losing strategy and one winning one, on purpose: a useful filter should cut the first's losses without wrecking the second.&lt;/p&gt;

&lt;p&gt;Before running the gated version I wrote down what would count as "the filter helps": beat the unfiltered return &lt;strong&gt;and&lt;/strong&gt; beat at least 95% of random gates that block the same share of requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens with QuantDinger's defaults?
&lt;/h2&gt;

&lt;p&gt;Nothing. The filter never makes a decision.&lt;/p&gt;

&lt;p&gt;QuantDinger only trusts Jev's answer when three of the six questions (&lt;code&gt;entry_decision&lt;/code&gt;, &lt;code&gt;risk_check&lt;/code&gt;, &lt;code&gt;execution_quality&lt;/code&gt;) each come back with a &lt;code&gt;confidence&lt;/code&gt; of 0.55 or more. Below that it treats Jev as failed and hands the decision to an ordinary LLM. With no LLM configured, the trade goes through.&lt;/p&gt;

&lt;p&gt;For the 1,324 trades in the chart below (both markets, at two position sizes), all three cleared 0.55 &lt;strong&gt;zero times&lt;/strong&gt;, and &lt;code&gt;execution_quality&lt;/code&gt; never went above 0.49. Across every response I collected for this post, 41,693 of them, all three never cleared together once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvxe7ez2pmq18r5wtpr2t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvxe7ez2pmq18r5wtpr2t.png" alt="Histograms of Jev's confidence on entry_decision, risk_check and execution_quality across 1,324 gate requests, BTC and gold 1h; execution_quality never reaches the 0.55 threshold" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part of this is how the API answers. Jev returns a probability for each choice and a separate &lt;code&gt;confidence&lt;/code&gt; field, and they're not the same number. On one BTC entry it chose &lt;code&gt;pass&lt;/code&gt; with probability 0.60 and confidence 0.20. QuantDinger reads &lt;code&gt;confidence&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So in this replay the filter changed nothing: the same 246 BTC trades at −20.7%, the same 416 gold trades at +96.2%. If you've switched it on without an LLM, my numbers say it isn't filtering. If you have an LLM configured, that LLM is the one making the calls, not Jev. You pay one credit per check either way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does Jev actually think?
&lt;/h2&gt;

&lt;p&gt;To see Jev's own opinion, I took the thresholds out and applied the rule to its chosen answers. That's not how QuantDinger behaves; it's the most generous reading of Jev.&lt;/p&gt;

&lt;p&gt;It blocked almost everything: 99.85% of entry requests on BTC (10,396 asked) and 99.69% on gold (17,512 asked). The reason was nearly always &lt;code&gt;risk_check = block&lt;/code&gt;, on 232 of 246 BTC entries. Jev objects to putting 95% of equity into one position, which is a fair point about QuantDinger's own example, but it's a point about sizing, not about the market.&lt;/p&gt;

&lt;p&gt;Blocking that much changes the results, so the test is whether Jev picked &lt;em&gt;which&lt;/em&gt; trades to keep better than chance. I ran 1,000 random gates that block the same share of requests:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;No filter&lt;/th&gt;
&lt;th&gt;Jev decides&lt;/th&gt;
&lt;th&gt;Random gates, median (5th–95th pct)&lt;/th&gt;
&lt;th&gt;Random gates as good or better&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BTC 1h&lt;/td&gt;
&lt;td&gt;−20.7%, 246 trades&lt;/td&gt;
&lt;td&gt;−9.1%, 16 trades, PF 0.55&lt;/td&gt;
&lt;td&gt;−1.6% (−14.7% to +20.2%)&lt;/td&gt;
&lt;td&gt;80%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gold 1h&lt;/td&gt;
&lt;td&gt;+96.2%, 416 trades&lt;/td&gt;
&lt;td&gt;+4.3%, 55 trades, PF 1.17&lt;/td&gt;
&lt;td&gt;+4.0% (−10.7% to +21.9%)&lt;/td&gt;
&lt;td&gt;48%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9ym5h377zbfkzhjljcke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9ym5h377zbfkzhjljcke.png" alt="Distribution of 1,000 random-gate returns for BTC and gold 1h, with Jev's result and the unfiltered result marked; Jev sits inside the random spread" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On BTC, Jev lost less than the unfiltered strategy only because it was hardly ever in the market, and most coin flips did that better. On gold it threw away almost all of a +96% run and landed right on the random median. Neither result meets the bar I set beforehand.&lt;/p&gt;

&lt;h2&gt;
  
  
  With a smaller position, can it tell good trades from bad?
&lt;/h2&gt;

&lt;p&gt;The sizing objection was drowning everything else out, so I cut the position to 10% of equity and asked Jev about every trade of the unfiltered strategy once. Now it blocks about one entry in five, mostly for &lt;code&gt;signal_conflict&lt;/code&gt;, which is the market reading I actually wanted to test.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;10% size&lt;/th&gt;
&lt;th&gt;Trades passed&lt;/th&gt;
&lt;th&gt;Trades blocked&lt;/th&gt;
&lt;th&gt;Passed minus blocked, avg per trade (95% CI)&lt;/th&gt;
&lt;th&gt;AUC of P(pass) vs winning trade&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BTC 1h&lt;/td&gt;
&lt;td&gt;197, avg −0.04%&lt;/td&gt;
&lt;td&gt;49, avg −0.07%&lt;/td&gt;
&lt;td&gt;+0.02 pts (−0.72 to +0.79)&lt;/td&gt;
&lt;td&gt;0.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gold 1h&lt;/td&gt;
&lt;td&gt;329, avg +0.20%&lt;/td&gt;
&lt;td&gt;87, avg +0.11%&lt;/td&gt;
&lt;td&gt;+0.09 pts (−0.25 to +0.41)&lt;/td&gt;
&lt;td&gt;0.53&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6gsdzoibreofdr83dq9a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6gsdzoibreofdr83dq9a.png" alt="Difference in average return per trade between trades Jev passed and trades it blocked, with 95% confidence intervals crossing zero for BTC and gold 1h, 10% position size" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The trades it blocked weren't worse than the ones it let through. Every interval crosses zero, and an AUC of 0.50–0.53 is a coin flip. I'd set 0.55 in advance as the minimum to say Jev separates good entries from bad. It didn't get there, and its market answers (&lt;code&gt;aligned&lt;/code&gt;, &lt;code&gt;conflict&lt;/code&gt;, &lt;code&gt;favorable&lt;/code&gt;, &lt;code&gt;adverse&lt;/code&gt;) stayed between 0.47 and 0.55.&lt;/p&gt;

&lt;p&gt;That matches &lt;a href="https://moonthetrain.com/lab/can-jev-predict-bitcoin" rel="noopener noreferrer"&gt;part 5&lt;/a&gt;, where Jev read clean indicators accurately but couldn't say where Bitcoin was going next.&lt;/p&gt;

&lt;h2&gt;
  
  
  What would I do with this?
&lt;/h2&gt;

&lt;p&gt;If you run QuantDinger: don't treat the Jev filter as a safety layer. With the defaults it's off in practice, and with the thresholds removed it's a coin flip that mostly says no. The parts of the platform I'd keep relying on are the plain-code ones from &lt;a href="https://moonthetrain.com/lab/quantdinger-review" rel="noopener noreferrer"&gt;part 2&lt;/a&gt;: the order budget and the rule that exits never wait on an AI.&lt;/p&gt;

&lt;p&gt;And for any AI gate, mine included: replay it before it touches money. This whole test cost about $5 in Jev credits.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I didn't check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The LLM fallback.&lt;/strong&gt; With an LLM configured, every decision in this replay would have gone to it. I didn't test any LLM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One strategy.&lt;/strong&gt; It's QuantDinger's own example, on two markets, 1h only. A strategy with smaller positions and different signals could get different answers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 10% size as a live gate.&lt;/strong&gt; I asked about each 10% trade once, but the bar-by-bar run at 10% stopped when my Jev credits ran out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dates in the state.&lt;/strong&gt; QuantDinger sends bar timestamps, so Jev could see the date. The Polymarket test found no memory of outcomes, but I didn't test memory of price paths.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data details.&lt;/strong&gt; Volume is Exness tick count, not exchange volume. Only completed bars go into the state; the live platform may include the forming bar. No swap on gold.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versions.&lt;/strong&gt; QuantDinger at commit &lt;code&gt;96cec2d&lt;/code&gt;, Jev 1.14.0 in early November 2026. The hosted version may be configured differently, and either side may change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this replay, QuantDinger's Jev filter either did nothing or did no better than chance.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>trading</category>
      <category>backtesting</category>
    </item>
    <item>
      <title>We let a profitable breakout strategy flip a coin for direction. It kept making money.</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sun, 01 Nov 2026 06:54:29 +0000</pubDate>
      <link>https://dev.to/moonthetrain/we-let-a-profitable-breakout-strategy-flip-a-coin-for-direction-it-kept-making-money-3emf</link>
      <guid>https://dev.to/moonthetrain/we-let-a-profitable-breakout-strategy-flip-a-coin-for-direction-it-kept-making-money-3emf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Take a daily breakout strategy on gold that has been profitable for five years. Keep the exact moments it enters the market. Replace its direction with a coin flip. Keep its trade management.&lt;/strong&gt; Run it 100 times with 100 different coins. All 100 runs are profitable, median profit factor 2.06, about half the profit of the original. &lt;strong&gt;Now keep the coin flip and remove the trade management.&lt;/strong&gt; On real ticks, every single run loses.&lt;/p&gt;

&lt;p&gt;That pair of results is what this article is about. A profitable breakout system turns out to be three separable things, &lt;em&gt;when&lt;/em&gt; it trades, &lt;em&gt;which way&lt;/em&gt; it trades, and &lt;em&gt;how it handles the trade afterwards&lt;/em&gt;, and they do not contribute to the profit the way most of us assume. The rest of the post is the method, the numbers, what I think they mean, and a backtest-only EA so you can check the main result against your own broker's data (&lt;a href="https://moonthetrain.com/lab/breakout-timing-direction-management-experiment#:~:text=Downloads%3A%20repeat%20the%20experiment" rel="noopener noreferrer"&gt;free download for MT4, MT5 and cTrader&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  The question
&lt;/h2&gt;

&lt;p&gt;For two months I reverse-engineered commercial gold EAs from their trade lists, rebuilt the common engine behind a family of them as my own cBot/EA, and matched it trade for trade against the originals (195 of 195 trades over five years on one parameter set). Once the engine matched, I could start taking it apart. The first question was the obvious one:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where does the profit come from, the entry or the management of the trade after entry?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I had a hypothesis, and it was the fashionable one: the entry barely matters. Three pieces of evidence pointed that way. Measured fifteen minutes after a fill, with no management, the strategy's entries were a coin flip: median move about zero, 44–55 % winners. A machine-learning model I trained to predict the &lt;strong&gt;direction&lt;/strong&gt; of gold over the next 100 minutes scored AUC 0.47–0.52, which is noise. The same features predicting whether a &lt;strong&gt;large move&lt;/strong&gt; was coming, in either direction, scored 0.85. So: you can tell &lt;em&gt;that&lt;/em&gt; something is about to happen, you cannot tell &lt;em&gt;which way&lt;/em&gt;, and a good exit should be able to monetise the first without the second.&lt;/p&gt;

&lt;p&gt;The hypothesis was half right. The experiment is more interesting than the hypothesis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method
&lt;/h2&gt;

&lt;p&gt;Everything runs on one dataset: XAUUSD, raw-spread account, July 2021 to October 2026, 10,000 USD, 0.1 lots scaled by price (about 0.05 lots at 4,000 USD gold). Two data modes: 1-minute bars with four ticks per bar for the 100-seed runs, and the full 257-million-tick archive with real spread for a confirmation pass.&lt;/p&gt;

&lt;p&gt;The strategy is a daily-level breakout with a rich management layer. Parameters are the published defaults of a widely sold EA family; I did not tune anything.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Entry&lt;/td&gt;
&lt;td&gt;Daily swing highs and lows (higher than 24 bars to the left, not lower than 3 to the right). Buy stop placed 275 pips &lt;em&gt;inside&lt;/em&gt; the high, sell stop 160 pips inside the low. Up to 5 pending orders per side, 35-hour expiry. All distances scale with the price level.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stop / target&lt;/td&gt;
&lt;td&gt;Stop 3.05 % of price, target 0.725 %.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Breakeven&lt;/td&gt;
&lt;td&gt;At +0.93 % profit the stop moves to entry +0.12 %.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trailing stop&lt;/td&gt;
&lt;td&gt;From +1.8 % profit, trail 1.8 % behind price.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pulled target&lt;/td&gt;
&lt;td&gt;When a trade is 1.6 % under water, the target is pulled to price +0.7 %: exit on the first bounce.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reversal cut&lt;/td&gt;
&lt;td&gt;If the M1 or M15 candle containing the fill closes against the trade, close it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Filter&lt;/td&gt;
&lt;td&gt;No trading around the monthly US jobs report.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;"Management on" means all of it. "Management off" means the original stop and target only. The entry was then replaced by three alternatives, each run with management on and off:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Coin flip, full.&lt;/strong&gt; At each 15-minute bar, enter with a probability calibrated to the original's frequency (37 trades a year). Direction by coin flip. Market order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Original timing, coin-flip direction.&lt;/strong&gt; Keep the exact instants the original's stop orders fill. At each one, with probability 0.5, open the &lt;em&gt;opposite&lt;/em&gt; trade instead, with stop and target distances mirrored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Original timing, opposite direction.&lt;/strong&gt; Probability 1. Every breakout is faded.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Random variants run 100 seeds on bars, 10 on ticks. The generator is a deterministic xorshift that produces the same sequence in the C#, MQL5 and MQL4 builds, so seed 7 is the same experiment on every platform. Before any of this, the engine's "no change" configuration was checked to reproduce the original trade list exactly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result 1 — management does not turn noise into money
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiw724s6t4cgmf17y00oh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiw724s6t4cgmf17y00oh.png" alt="Coin-flip entry, 100 seeds" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Random timing, random direction, full management: median PF &lt;strong&gt;0.95&lt;/strong&gt;, 45 % of seeds positive, median result −132 USD on 10,000. Win rate 19 %. The management layer does what it is designed to do, it cuts losers at breakeven or on the first bounce, which is why a 19 % win rate is nearly break-even rather than a catastrophe. It is not a source of profit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgjyup36ob9lozwu49cbh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgjyup36ob9lozwu49cbh.png" alt="Coin-flip equity curves" width="799" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The blue cloud is 100 random seeds, the red line is the original strategy. No seed approaches it. Over 2025 in isolation the cloud drifts positive (median PF 1.16, 60 % of seeds), because gold rose 60 % that year and the trailing stop rode part of it. That is the market, not the method. So the first thing the experiment did was refute my own hypothesis: "any entry plus good management" does not work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result 2 — timing alone is worth half the profit, even with a coin flip for direction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnzbv3kvzzt5xcbtog6ho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnzbv3kvzzt5xcbtog6ho.png" alt="Original timing, coin-flip direction" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep the 195 moments the original entered, flip a coin for direction: &lt;strong&gt;100 of 100 seeds profitable&lt;/strong&gt;, median PF 2.06, median profit +3,663 USD. Original timing, original direction: PF 2.45, +7,414. Original timing, every trade faded: PF 0.74, −409.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fewk84yd1rx24diuia9ae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fewk84yd1rx24diuia9ae.png" alt="Original timing, three directions" width="799" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The three lines decompose the edge. With the break: +7,414. Against it: −409. Coin flip: +3,663, almost exactly the average, as arithmetic says it must be. The entry's value therefore splits into two roughly equal halves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Timing&lt;/strong&gt; — being in the market right after a daily level breaks, when a large move is likely. This half survives the coin flip entirely. It is also the half the volatility model could predict.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Direction&lt;/strong&gt; — trading with the break rather than against it. Worth another +3,700 over five years. Real, but it is the thin half, and the fade line is what getting it wrong looks like.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note the win rates. The fade wins &lt;strong&gt;77 %&lt;/strong&gt; of its trades and loses. The coin flip wins 69 %. The original wins 61 %. Win rate ranks these three in exactly the wrong order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result 3 — management is what converts timing into money
&lt;/h2&gt;

&lt;p&gt;Same three entries, management off, stop and target only:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6n5lc1vgi39w7rq1rj6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6n5lc1vgi39w7rq1rj6.png" alt="Eight configurations, profit and drawdown" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Original timing, coin-flip direction, no management: median PF &lt;strong&gt;0.72&lt;/strong&gt;, median result &lt;strong&gt;−6,088 USD&lt;/strong&gt;, 6 of 100 seeds positive, median drawdown 9,738 USD on a 10,000 account. Same entries with management: +3,663, 100 of 100 seeds, drawdown 622.&lt;/p&gt;

&lt;p&gt;This is the finding. &lt;strong&gt;Trade management does not create an edge. It is the mechanism that lets you collect an edge you can only half see.&lt;/strong&gt; You know a move is coming and not its direction. Without breakeven, pulled targets and reversal cuts, the wrong-way half of your trades runs to the 3 % stop and consumes the right-way half. With them, the wrong-way half costs a fraction of a percent and the right-way half pays.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result 4 — when the entry is already right, management buys drawdown with profit
&lt;/h2&gt;

&lt;p&gt;The original strategy with management off makes &lt;em&gt;more&lt;/em&gt;: +11,494 against +7,414. It also holds trades for a median 22 hours instead of 3.8, rarely reaches its 3 % stop, and takes a 2,683 USD drawdown instead of 674. Profit per unit of drawdown falls from 11.0 to 4.3. At equal drawdown you could run the managed version at roughly four times the size.&lt;/p&gt;

&lt;p&gt;Two cautions. These bars have no spread and no swap, so a 22-hour hold is free here and is not free in a live account. And the drawdown ratio, not the profit, is the number that decides position size. Which brings us to the tick data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Confirmation on 257 million real ticks
&lt;/h2&gt;

&lt;p&gt;Same account, same lots, same period, the full tick archive with real spread. Fewer seeds because each run takes longer.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Entry&lt;/th&gt;
&lt;th&gt;Management on: PF · net · DD · % runs positive&lt;/th&gt;
&lt;th&gt;Management off: PF · net · DD · % runs positive&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Coin flip, full (10 seeds, median)&lt;/td&gt;
&lt;td&gt;0.98 · −71 · 866 · 40 %&lt;/td&gt;
&lt;td&gt;0.78 · −3,302 · 4,806 · 0 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Original timing, coin-flip direction&lt;/strong&gt; (10 seeds, median)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.70 · +2,896 · 825 · 100 %&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.78 · −4,830 · 9,138 · 0 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Original timing, original direction&lt;/td&gt;
&lt;td&gt;2.36 · +7,292 · 674&lt;/td&gt;
&lt;td&gt;2.40 · +11,879 · 2,683&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Original timing, faded&lt;/td&gt;
&lt;td&gt;0.22 · −1,936 · 2,077&lt;/td&gt;
&lt;td&gt;0.34 · −22,998 · 23,938&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Real ticks are harsher on everything except the original with management, which is unchanged (+7,292 against +7,414 on bars). The coin-flip-direction variant keeps all 10 seeds profitable but drops from PF 2.06 to 1.70: spread and slippage come out of the wrong-way half. The fade collapses to PF 0.22. The conclusion sharpens: &lt;strong&gt;on real ticks, every run without management lost money, including all 16 random seeds.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While the ticks were loaded, I removed the management layers one at a time, original entries, original direction:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer removed&lt;/th&gt;
&lt;th&gt;Net&lt;/th&gt;
&lt;th&gt;PF&lt;/th&gt;
&lt;th&gt;Drawdown&lt;/th&gt;
&lt;th&gt;Win rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;none (full strategy)&lt;/td&gt;
&lt;td&gt;+7,292&lt;/td&gt;
&lt;td&gt;2.36&lt;/td&gt;
&lt;td&gt;674&lt;/td&gt;
&lt;td&gt;60 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;breakeven&lt;/td&gt;
&lt;td&gt;+7,793&lt;/td&gt;
&lt;td&gt;2.18&lt;/td&gt;
&lt;td&gt;674&lt;/td&gt;
&lt;td&gt;55 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;trailing stop&lt;/td&gt;
&lt;td&gt;+7,292&lt;/td&gt;
&lt;td&gt;2.36&lt;/td&gt;
&lt;td&gt;674&lt;/td&gt;
&lt;td&gt;60 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pulled target&lt;/td&gt;
&lt;td&gt;+8,092&lt;/td&gt;
&lt;td&gt;2.53&lt;/td&gt;
&lt;td&gt;1,178&lt;/td&gt;
&lt;td&gt;65 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reversal cut&lt;/td&gt;
&lt;td&gt;+9,516&lt;/td&gt;
&lt;td&gt;2.62&lt;/td&gt;
&lt;td&gt;1,223&lt;/td&gt;
&lt;td&gt;80 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;swing trailing&lt;/td&gt;
&lt;td&gt;+7,000&lt;/td&gt;
&lt;td&gt;2.24&lt;/td&gt;
&lt;td&gt;686&lt;/td&gt;
&lt;td&gt;60 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jobs-report filter&lt;/td&gt;
&lt;td&gt;+6,808&lt;/td&gt;
&lt;td&gt;2.17&lt;/td&gt;
&lt;td&gt;826&lt;/td&gt;
&lt;td&gt;59 %&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three observations. The trailing stop &lt;strong&gt;never fires&lt;/strong&gt;: its activation level (1.8 %) lies above the take-profit (0.725 %), so the published defaults ship a dead parameter that no backtest would ever reveal. The two layers that do the work are the pulled target and the reversal cut: remove either and drawdown nearly doubles while profit &lt;em&gt;rises&lt;/em&gt;. And every layer in the table costs profit and buys drawdown. That is what trade management is for, and it is why it cannot be evaluated with a profit figure.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I take from this
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Direction is the thin half.&lt;/strong&gt; Neither the strategy's own logic nor my models predict it at these horizons. Spend the optimisation budget on &lt;em&gt;when&lt;/em&gt; to be in the market.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Win rate measures nothing here.&lt;/strong&gt; 77 % won and lost money; so did a night-scalping EA I examined that wins 96 % of its tester trades and made +605 USD on 10,000 in 5.8 years.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Any entry plus a trailing stop" is false.&lt;/strong&gt; 100 seeds on bars, 10 on ticks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluate management by drawdown.&lt;/strong&gt; Switching it off looked better on profit and was four times worse on drawdown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check which layers actually fire.&lt;/strong&gt; One of the five in this system never did.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A related observation from the same reverse-engineering work: one EA I took apart matched its own published backtest on 90 % of entries in live trading and kept 24 % of the backtested profit. Entries identical, exit layer behaving differently live, three quarters of the money gone. Exits are where backtests and live accounts diverge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations and the objections I expect
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"So entries do matter."&lt;/strong&gt; Timing does, a lot; the first chart is the evidence against my own starting hypothesis. Direction matters much less than the attention it receives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"This needs a trending market."&lt;/strong&gt; Yes. The second half of 2021 was negative for every configuration including the original. The method needs volatility, not direction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"The parameters are in-sample."&lt;/strong&gt; They are the vendor's published defaults, tuned on data that overlaps this period. I tuned nothing. The coin-flip and flipped-direction runs are, by construction, something no vendor optimised for, and they are where the result lives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"One parameter set, one instrument."&lt;/strong&gt; Correct. The next post repeats this on H4 and H1 variants of the same engine and on the two layers that carried the table, with their parameters swept on real ticks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Bars, not ticks."&lt;/strong&gt; The 100-seed charts are bars. The tick table is not, and it says the same thing more sharply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Downloads: repeat the experiment
&lt;/h2&gt;

&lt;p&gt;The engine used in every test above is available as a free, backtest-only build for cTrader, MetaTrader 5 and MetaTrader 4, with this article's settings built in. It runs in the strategy tester (backtest and optimisation); on a live or demo chart it refuses to start.&lt;/p&gt;

&lt;p&gt;Free, no account needed, one download per terminal (MT5, MT4, cTrader): &lt;strong&gt;&lt;a href="https://moonthetrain.com/lab/breakout-timing-direction-management-experiment#:~:text=Downloads%3A%20repeat%20the%20experiment" rel="noopener noreferrer"&gt;download Notus from the original article&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To check the main result, run XAUUSD 2021–2026 with the default inputs, tick data if your broker provides it. That is the red line. Daily bars start at 00:00 UTC; on MT4/MT5 enter your broker's UTC offset if its server isn't on UTC. If your curve disagrees with mine, I want to see it in the comments.&lt;/p&gt;

&lt;p&gt;The coin-flip and management-off runs used a research build of the same engine with every layer exposed as a switch. That build isn't distributed.&lt;/p&gt;

</description>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Does Turtle Trading Still Work? What 6.7 Years Showed</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Wed, 28 Oct 2026 01:02:58 +0000</pubDate>
      <link>https://dev.to/moonthetrain/does-turtle-trading-still-work-what-67-years-showed-2ijm</link>
      <guid>https://dev.to/moonthetrain/does-turtle-trading-still-work-what-67-years-showed-2ijm</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; On the data I have, no: the original Turtle trading rules lost 37.9% on 11 Exness markets and 57.7% on 26, from January 2020 to September 2026, with the code checked three ways. But 6.7 years is a short window for a trend system, and the result is mostly one-sided: long trades made money in every market group, short trades lost in every group. The tempting fix, dropping the shorts, is exactly the kind of decision you can't make after seeing the results. Here's what I think the test does show, what it doesn't, and what I didn't do.&lt;/p&gt;

&lt;p&gt;This is the last of 5 parts: &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-the-1983-experiment-tested-in-2026-1iop"&gt;the 1983 experiment&lt;/a&gt;, &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg"&gt;the rules&lt;/a&gt;, &lt;a href="https://dev.to/moonthetrain/turtle-trading-backtest-in-python-building-the-simulator-120h"&gt;the simulator&lt;/a&gt;, &lt;a href="https://dev.to/moonthetrain/turtle-trading-backtest-results-26-markets-577-55b1"&gt;the results&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does Turtle trading still work in 2026?
&lt;/h2&gt;

&lt;p&gt;Not as published, on Exness CFDs, from 2020 to 2026. The numbers, briefly:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;11 markets&lt;/th&gt;
&lt;th&gt;26 markets&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Return&lt;/td&gt;
&lt;td&gt;−37.9%&lt;/td&gt;
&lt;td&gt;−57.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;58.3%&lt;/td&gt;
&lt;td&gt;75.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor&lt;/td&gt;
&lt;td&gt;0.89&lt;/td&gt;
&lt;td&gt;0.83&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long trades&lt;/td&gt;
&lt;td&gt;+$26,899&lt;/td&gt;
&lt;td&gt;+$28,279&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Short trades&lt;/td&gt;
&lt;td&gt;−$64,779&lt;/td&gt;
&lt;td&gt;−$85,989&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's a narrow claim, and I want to keep it narrow. It says these exact rules didn't make money on these markets in this period. It doesn't say trend following is dead, and it doesn't say the 1980s results were wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 1: the rules are good engineering
&lt;/h2&gt;

&lt;p&gt;The 2003 PDF is unusually complete. Every rule has a number, most have a worked example, and only six points are left open (I listed them in &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg"&gt;part 2&lt;/a&gt;). That made the system testable in a way most trading folklore isn't, and it meant I could write tests straight from the document's own examples.&lt;/p&gt;

&lt;p&gt;The risk side held up too. Switching off the filter, the unit limits or the drawdown rule each made the result clearly worse (in &lt;a href="https://dev.to/moonthetrain/turtle-trading-backtest-results-26-markets-577-55b1"&gt;part 4&lt;/a&gt;, the yearly loss went from −6.8% to between −10.5% and −16.2%). The layers do what they were designed to do: they cut losses when the entries aren't working.&lt;/p&gt;

&lt;p&gt;But risk management can't create an edge that the entries don't have. It only decides how much you lose while you wait for one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 2: more markets only help if they have an edge
&lt;/h2&gt;

&lt;p&gt;Diversification is the standard answer to "the basket is too narrow", and it's what the original Turtles had. I tested it: 15 more markets across oil, gas, metals and six stock indices. The result went from −37.9% to −57.7%.&lt;/p&gt;

&lt;p&gt;Adding uncorrelated markets smooths the curve when each market has a small positive expectation. When the extra markets lose too, you just get more losing trades, and the shared unit limits mean the good signals compete with the bad ones for the same risk budget.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 3: why I didn't just drop the shorts
&lt;/h2&gt;

&lt;p&gt;This is the one I had to think about most.&lt;/p&gt;

&lt;p&gt;Long trades made money in all five groups: forex, metals, energy, indices and bitcoin. Short trades lost in all five. 20 of the 26 markets ended the period higher than they started. So a long-only Turtle system would have looked fine on this data, and it's the obvious next step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgk6oaqnt6jyy7lmlvoew.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgk6oaqnt6jyy7lmlvoew.png" alt="20 of 26 markets ended higher than they started, 2020 to 2026, first versus last daily close" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The problem is that I'd be choosing the rule after seeing which half of the results was good. Of course long-only looks better on a period where most markets went up: that's what the period was. Testing long-only on the same 2020–2026 data would only confirm what I'd already looked at. It proves nothing about the next six years.&lt;/p&gt;

&lt;p&gt;A fair test of that idea needs data the rules haven't seen, and the pass criteria written down before it runs. My Exness archive starts in 2020, so there's no unseen stretch left in it. I decided not to run the long-only version at all rather than run it on data I'd already looked at.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 4: 6.7 years is short for a trend system
&lt;/h2&gt;

&lt;p&gt;The rules document itself warns that Turtle traders went through losing stretches of a year or two, and that the traders who did worst were the ones who started skipping signals during them. In my data the 11-market basket had four losing years out of seven, with one +40% year (2022) in the middle.&lt;/p&gt;

&lt;p&gt;A trend system lives on a few large moves. Six and a half years contains only so many of them, and which ones you get depends a lot on where the window starts. So I'd treat this as one sample, not a verdict on the method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 5: CFDs aren't the 1983 futures
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Swap.&lt;/strong&gt; Turtle positions are held for weeks. On the 11-market run, where swap is measured on just 3 markets (gold among them), swap already cost $19,499. On the other markets it's set to zero, so the real result would likely be a bit worse.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spread.&lt;/strong&gt; Paid on every entry and exit. Doubling it took another 1.7% a year off the 11-market result.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The market list.&lt;/strong&gt; The Turtles traded Treasury bonds and notes, Eurodollars, coffee, cocoa, sugar and cotton, none of which I have as CFDs. My basket is heavier in forex crosses, which spent long stretches going sideways.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lesson 6: shorter bars make it worse, not better
&lt;/h2&gt;

&lt;p&gt;The intuitive fix for "markets are faster now" is a faster chart. The cost side says no: on gold, the spread is 0.30% of a daily N, 1.33% of an hourly N and 2.68% of a 15-minute N, and a breakout system trades much more often on short bars. Published research also finds trend effects over months, not hours. Details in &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg"&gt;part 2&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I didn't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No parameter optimisation.&lt;/strong&gt; I didn't try 30-day breakouts, 3N stops or a different add interval. With seven years of data and that many knobs, I'd find a setting that worked on 2020–2026, and it would tell me nothing about 2027.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No long-only version&lt;/strong&gt;, for the reasons above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Whipsaw stop&lt;/strong&gt;, the PDF's alternative half-N stop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No live trading.&lt;/strong&gt; Everything here is a simulation on archive data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The limits of this test
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Swap measured on 3 of 26 markets; commission on commodity and index CFDs unconfirmed; both set to zero where unknown.&lt;/li&gt;
&lt;li&gt;Some contract sizes for commodities and indices unconfirmed (with N-based sizing this mostly affects lot rounding).&lt;/li&gt;
&lt;li&gt;Data gaps: UKOIL and XPTUSD have missing months; XNGUSD, JP225 and XCUUSD start in 2022–2023.&lt;/li&gt;
&lt;li&gt;One broker, one period, CFDs instead of futures.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If anything, the costs I couldn't measure would make the results a bit worse, not better.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is the Turtle system good for today?
&lt;/h2&gt;

&lt;p&gt;As a teaching system, a lot. It's the clearest example I know of a complete trading plan: what to trade, how much, when to enter, when to get out of losers, when to get out of winners, and how much total risk to carry. Volatility-based sizing and hard portfolio limits are worth copying into almost anything.&lt;/p&gt;

&lt;p&gt;As a ready-made system to switch on, not on this evidence. If I come back to it, it'll be with data the rules haven't seen and the pass mark written down first.&lt;/p&gt;

&lt;p&gt;Thanks for reading the series. There's a &lt;a href="https://youtu.be/PO_4rIQtF1I" rel="noopener noreferrer"&gt;7-minute video version on YouTube&lt;/a&gt;, with the same numbers drawn from the same data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Research, not financial advice. Past results do not predict future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Turtle Trading Backtest Results: 26 Markets, -57.7%</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Tue, 27 Oct 2026 01:54:50 +0000</pubDate>
      <link>https://dev.to/moonthetrain/turtle-trading-backtest-results-26-markets-577-55b1</link>
      <guid>https://dev.to/moonthetrain/turtle-trading-backtest-results-26-markets-577-55b1</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; I ran the original Turtle trading rules, unchanged, on Exness tick data from January 2020 to September 2026. On 11 markets (forex, gold, S&amp;amp;P 500, bitcoin) a $100,000 account ended at &lt;strong&gt;$62,136 (−37.9%, max drawdown 58.3%)&lt;/strong&gt;. Switching off the filter, the unit limits or the drawdown rule made it worse; none of the variants made money. On 26 markets it got worse again: &lt;strong&gt;$42,299 (−57.7%, max drawdown 75.6%)&lt;/strong&gt;. The split by direction is the clearest finding: long trades made money in every market group, short trades lost money in every group.&lt;/p&gt;

&lt;p&gt;This is part 4 of 5. &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg"&gt;Part 2&lt;/a&gt; has the rules and &lt;a href="https://dev.to/moonthetrain/turtle-trading-backtest-in-python-building-the-simulator-120h"&gt;part 3&lt;/a&gt; the simulator and its checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup, in one paragraph
&lt;/h2&gt;

&lt;p&gt;Original rules as published in 2003: N = 20-day Wilder ATR updated on Mondays, 1% risk per unit, System 1 (20/10 days, with the filter and 55-day failsafe) and System 2 (55/20 days) each on half the capital, adds every half N up to 4 units, 2N stops, 4/6/10/12 unit limits, the 10% drawdown rule. Daily signals, fills minute by minute on Exness Raw Spread data, real spreads, one shared account. No parameter was changed or optimised. "Positions" below count one trade with all its units; profit factor is per position; drawdown is on daily equity.&lt;/p&gt;

&lt;h2&gt;
  
  
  How did Turtle trading do on 11 markets?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;11 markets&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Markets&lt;/td&gt;
&lt;td&gt;EURUSD, GBPUSD, NZDUSD, USDJPY, AUDCAD, NZDCAD, AUDNZD, EURCHF, XAUUSD, US500, BTCUSD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Period&lt;/td&gt;
&lt;td&gt;29 Jan 2020 – 23 Sep 2026 (6.7 years)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;End equity&lt;/td&gt;
&lt;td&gt;$62,136&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Return&lt;/td&gt;
&lt;td&gt;−37.9% (−6.9% a year)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;58.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Positions / units&lt;/td&gt;
&lt;td&gt;834 / 1,498&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Winning positions&lt;/td&gt;
&lt;td&gt;27.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor&lt;/td&gt;
&lt;td&gt;0.89&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average win / loss&lt;/td&gt;
&lt;td&gt;+$1,392 / −$586&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Commission / swap&lt;/td&gt;
&lt;td&gt;−$3,090 / −$19,499&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5p3ardqxkb6o5eh7wzxo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5p3ardqxkb6o5eh7wzxo.png" alt="Equity of the original Turtle rules on 11 Exness markets, 2020 to 2026, with the maximum drawdown marked" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A 27% win rate with winners more than twice the size of losers is exactly what a trend system is supposed to look like. It just wasn't enough: winners need to be roughly 2.7 times the losers at that win rate to break even, and these were 2.4 times.&lt;/p&gt;

&lt;p&gt;By year, on equity at the start of each year:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;2020&lt;/th&gt;
&lt;th&gt;2021&lt;/th&gt;
&lt;th&gt;2022&lt;/th&gt;
&lt;th&gt;2023&lt;/th&gt;
&lt;th&gt;2024&lt;/th&gt;
&lt;th&gt;2025&lt;/th&gt;
&lt;th&gt;2026 (to Sep)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;−26.5%&lt;/td&gt;
&lt;td&gt;−13.8%&lt;/td&gt;
&lt;td&gt;+40.1%&lt;/td&gt;
&lt;td&gt;−37.5%&lt;/td&gt;
&lt;td&gt;+23.8%&lt;/td&gt;
&lt;td&gt;−16.6%&lt;/td&gt;
&lt;td&gt;+8.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh9robn93r1q39rzydjel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh9robn93r1q39rzydjel.png" alt="Return by year for the 11-market basket" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By market, the money came from a few long trends and was lost in pairs that went sideways:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Made money&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Lost money&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;USDJPY&lt;/td&gt;
&lt;td&gt;+$13,589&lt;/td&gt;
&lt;td&gt;AUDCAD&lt;/td&gt;
&lt;td&gt;−$22,539&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BTCUSD&lt;/td&gt;
&lt;td&gt;+$13,359&lt;/td&gt;
&lt;td&gt;NZDCAD&lt;/td&gt;
&lt;td&gt;−$18,132&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XAUUSD&lt;/td&gt;
&lt;td&gt;+$12,927&lt;/td&gt;
&lt;td&gt;GBPUSD&lt;/td&gt;
&lt;td&gt;−$16,387&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EURUSD&lt;/td&gt;
&lt;td&gt;+$9,092&lt;/td&gt;
&lt;td&gt;NZDUSD&lt;/td&gt;
&lt;td&gt;−$13,088&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;EURCHF&lt;/td&gt;
&lt;td&gt;−$8,842&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;AUDNZD&lt;/td&gt;
&lt;td&gt;−$5,092&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;US500&lt;/td&gt;
&lt;td&gt;−$2,768&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both systems lost: System 1 −$7,268 on 478 positions, System 1 via the 55-day failsafe −$7,182 on 108, System 2 −$23,430 on 248.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which Turtle rules actually helped?
&lt;/h2&gt;

&lt;p&gt;I switched off one rule at a time on the 11 markets. (This set was run before I switched currency conversion to real daily FX rates, so the base line is −37.5% instead of −37.9%; the difference doesn't change any comparison.)&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;th&gt;End equity&lt;/th&gt;
&lt;th&gt;Return a year&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Full rules&lt;/td&gt;
&lt;td&gt;$62,473&lt;/td&gt;
&lt;td&gt;−6.8%&lt;/td&gt;
&lt;td&gt;58.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No System 1 filter&lt;/td&gt;
&lt;td&gt;$34,934&lt;/td&gt;
&lt;td&gt;−14.6%&lt;/td&gt;
&lt;td&gt;71.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No unit limits&lt;/td&gt;
&lt;td&gt;$30,861&lt;/td&gt;
&lt;td&gt;−16.2%&lt;/td&gt;
&lt;td&gt;80.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No drawdown rule&lt;/td&gt;
&lt;td&gt;$47,933&lt;/td&gt;
&lt;td&gt;−10.5%&lt;/td&gt;
&lt;td&gt;76.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System 1 only&lt;/td&gt;
&lt;td&gt;$25,231&lt;/td&gt;
&lt;td&gt;−18.7%&lt;/td&gt;
&lt;td&gt;85.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System 2 only&lt;/td&gt;
&lt;td&gt;$30,955&lt;/td&gt;
&lt;td&gt;−16.2%&lt;/td&gt;
&lt;td&gt;90.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;N updated daily&lt;/td&gt;
&lt;td&gt;$64,013&lt;/td&gt;
&lt;td&gt;−6.5%&lt;/td&gt;
&lt;td&gt;55.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spread × 2&lt;/td&gt;
&lt;td&gt;$55,259&lt;/td&gt;
&lt;td&gt;−8.5%&lt;/td&gt;
&lt;td&gt;59.9%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F330vckxzzd97vk2s4272.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F330vckxzzd97vk2s4272.png" alt="Yearly return for each configuration with one rule switched off" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every safety layer did its job: without the filter, the limits or the drawdown rule, losses grew. Running only one system (with all the capital on it, so twice the risk per unit) was much worse. Updating N daily instead of weekly made no real difference. Doubling the spread cost about 1.7% a year. And none of the eight configurations made money.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does a bigger basket fix it?
&lt;/h2&gt;

&lt;p&gt;The original Turtles traded more than 20 futures markets across rates, currencies, metals, energy, softs and stock indices. Eleven mostly-forex markets is a narrow basket, so I added 15 more: AUDUSD, USDCAD, USDCHF, US and UK oil, natural gas, silver, platinum, copper, and six stock indices (DE30, STOXX50, UK100, JP225, AUS200, HK50).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;11 markets&lt;/th&gt;
&lt;th&gt;26 markets&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;End equity&lt;/td&gt;
&lt;td&gt;$62,136&lt;/td&gt;
&lt;td&gt;$42,299&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Return&lt;/td&gt;
&lt;td&gt;−37.9%&lt;/td&gt;
&lt;td&gt;−57.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Return a year&lt;/td&gt;
&lt;td&gt;−6.9%&lt;/td&gt;
&lt;td&gt;−12.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;58.3%&lt;/td&gt;
&lt;td&gt;75.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Positions / units&lt;/td&gt;
&lt;td&gt;834 / 1,498&lt;/td&gt;
&lt;td&gt;1,232 / 1,945&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Winning positions&lt;/td&gt;
&lt;td&gt;27.3%&lt;/td&gt;
&lt;td&gt;29.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor&lt;/td&gt;
&lt;td&gt;0.89&lt;/td&gt;
&lt;td&gt;0.83&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fep3a5qyvmjpx8vn4woml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fep3a5qyvmjpx8vn4woml.png" alt="Equity of the 26-market basket against the 11-market basket" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By year on 26 markets: 2020 −34.4%, 2021 −24.0%, 2022 +2.7%, 2023 −37.0%, 2024 +6.8%, 2025 +16.6%, 2026 to September +5.3%.&lt;/p&gt;

&lt;p&gt;The unit limits worked hard: they blocked 6,670 entries, and 5,645 adds were skipped. With more markets competing for the same 12 units per direction, the basket isn't 26 independent bets, it's the same risk budget spread across more signals. And most of the new markets lost money too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flrtlmrq7myxbfj5dy3x3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flrtlmrq7myxbfj5dy3x3.png" alt="Profit per market for the 26-market basket, grouped by asset class" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Do Turtle long trades and short trades behave differently?
&lt;/h2&gt;

&lt;p&gt;This is the clearest result in the whole test.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Group&lt;/th&gt;
&lt;th&gt;Positions&lt;/th&gt;
&lt;th&gt;Total&lt;/th&gt;
&lt;th&gt;Long trades&lt;/th&gt;
&lt;th&gt;Short trades&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Forex (11)&lt;/td&gt;
&lt;td&gt;637&lt;/td&gt;
&lt;td&gt;−$27,743&lt;/td&gt;
&lt;td&gt;+$1,513&lt;/td&gt;
&lt;td&gt;−$29,256&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Metals (4)&lt;/td&gt;
&lt;td&gt;132&lt;/td&gt;
&lt;td&gt;−$264&lt;/td&gt;
&lt;td&gt;+$12,352&lt;/td&gt;
&lt;td&gt;−$12,616&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Energy (3)&lt;/td&gt;
&lt;td&gt;141&lt;/td&gt;
&lt;td&gt;−$5,118&lt;/td&gt;
&lt;td&gt;+$6,093&lt;/td&gt;
&lt;td&gt;−$11,212&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stock indices (7)&lt;/td&gt;
&lt;td&gt;296&lt;/td&gt;
&lt;td&gt;−$30,205&lt;/td&gt;
&lt;td&gt;+$2,658&lt;/td&gt;
&lt;td&gt;−$32,863&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bitcoin&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;+$5,620&lt;/td&gt;
&lt;td&gt;+$5,662&lt;/td&gt;
&lt;td&gt;−$42&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;All 26&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,232&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−$57,710&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+$28,279&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−$85,989&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Long trades made money in every group. Short trades lost money in every group. Part of the reason is the period: 20 of the 26 markets ended higher than they started (comparing the first and last daily close in the data), several by a lot: silver +266%, gold +172%, the S&amp;amp;P 500 +136%. A breakout system sells new lows, and in a market that keeps recovering, new lows tend to be followed by a bounce that hits the stop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaflxz073burggdh9axo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaflxz073burggdh9axo.png" alt="Long trades against short trades on 26 markets, and which markets ended higher than they started" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's what that looks like on one trade. Gold, June 2020: System 1 sold a new 20-day low on 5 June at 1,687.58 and added a second unit at 1,674.09. By 10 June the rebound hit the stop at 1,728.05. Loss: &lt;strong&gt;−$1,322.95&lt;/strong&gt; for both units together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgdqwdgqzfysdxwyvrt65.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgdqwdgqzfysdxwyvrt65.png" alt="A gold short in June 2020: sold at a new 20-day low and stopped out on the rebound within days" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's tempting to read this table and conclude "just trade the longs". Part 5 explains why I didn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I can't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Swap on 23 of the 26 markets&lt;/strong&gt; is not measured and is set to zero, and commission on the commodity and index CFDs is unconfirmed. Turtle trades are held for weeks, so real results would likely be somewhat worse. On the 11 markets, where three swaps are measured, swap already cost $19,499.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slippage&lt;/strong&gt; at breakouts beyond the spread isn't modelled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data gaps&lt;/strong&gt;: UKOIL is missing November 2020 to February 2022, XPTUSD November 2020 to November 2023, and XNGUSD, JP225 and XCUUSD start in 2022–2023.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Earlier periods.&lt;/strong&gt; My data starts in 2020. These results say nothing about how the rules did in the 1980s or 2000s.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, &lt;a href="https://moonthetrain.com/lab/does-turtle-trading-still-work" rel="noopener noreferrer"&gt;part 5: what I learned&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Research, not financial advice. Past results do not predict future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Turtle Trading Backtest in Python: Building the Simulator</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Mon, 26 Oct 2026 02:22:03 +0000</pubDate>
      <link>https://dev.to/moonthetrain/turtle-trading-backtest-in-python-building-the-simulator-120h</link>
      <guid>https://dev.to/moonthetrain/turtle-trading-backtest-in-python-building-the-simulator-120h</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; A Turtle backtest is harder to get right than it looks, because the rules live at three levels at once: daily channels for signals, intraday prices for fills and stops, and one shared account for unit limits across every market. I built the simulator in Python on Exness tick data from 2020 to 2026, checked fills minute by minute, and then tested the code three ways before trusting any result: 8 tests rebuilt from the worked examples in the original PDF, a look-ahead check at three cut dates, and an independent daily-bar version that matched trade for trade on three markets.&lt;/p&gt;

&lt;p&gt;This is part 3 of 5. &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg"&gt;Part 2&lt;/a&gt; went through the rules. &lt;a href="https://moonthetrain.com/lab/turtle-trading-backtest-results" rel="noopener noreferrer"&gt;Part 4&lt;/a&gt; has the results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just use a backtesting library?
&lt;/h2&gt;

&lt;p&gt;Most backtesting tools run one symbol at a time. The Turtle system doesn't work that way. Its unit limits (6 units across closely related markets, 10 across loosely related ones, 12 per direction) and its drawdown rule all depend on what every other market is doing at that minute. A 26-market portfolio has to be simulated as one account, with events from all markets interleaved in time order.&lt;/p&gt;

&lt;p&gt;So I wrote a small dedicated simulator. It still writes its trades in the same format as my single-symbol tools, so the same reports and comparisons work on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz9gr2l6vyhm6ei5xtuhr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz9gr2l6vyhm6ei5xtuhr.png" alt="The simulator: Exness ticks, M1 and D1 bars, levels from yesterday's daily bar, fills minute by minute, portfolio limits, trade list" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What data does it run on?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prices:&lt;/strong&gt; the Exness Raw Spread tick archive, January 2020 to September 2026, built into M1 and D1 bid bars with the spread kept per bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Daily bars:&lt;/strong&gt; Exness server time is UTC, so forex, gold and indices get a short Sunday bar of a few hours. Counting that as a full day would shorten every 20-day channel by about 4 real days a month, so I merge Sunday into Monday (crypto keeps its 7-day calendar).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Currency:&lt;/strong&gt; profits in JPY, CAD, CHF, EUR and other currencies are converted to USD with the real daily close of the matching pair, not a fixed rate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gaps in the archive:&lt;/strong&gt; a few markets have missing months (UKOIL, XPTUSD) or start late (XNGUSD, JP225, XCUUSD). Positions are closed on the last bar before a gap, and the market only trades again after 56 fresh daily bars.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why check fills minute by minute?
&lt;/h2&gt;

&lt;p&gt;Because a daily bar can't tell you the order things happened in. Here's a real example from the backtest: crude oil on 3 March 2026.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc8o6cd301x2wxgh1pbe4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc8o6cd301x2wxgh1pbe4.png" alt="Crude oil on 3 March 2026: the daily bar on the left, the minute path on the right with breakout, add and stop" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The daily bar runs from 70.63 to 77.21. From that alone you can't tell whether the low or the high came first. The minute data says:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time (UTC)&lt;/th&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;07:27&lt;/td&gt;
&lt;td&gt;System 1 breakout, unit 1&lt;/td&gt;
&lt;td&gt;73.105&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10:52&lt;/td&gt;
&lt;td&gt;add, next unit&lt;/td&gt;
&lt;td&gt;76.094&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;19:41&lt;/td&gt;
&lt;td&gt;the added unit's stop is hit&lt;/td&gt;
&lt;td&gt;72.109&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Unit 1 survived, because its own stop was lower, and it was finally closed on 14 April at 85.986 for +$1,288. The added unit lost $399. A daily-bar test has to guess this order, and over 1,232 positions those guesses add up. That's why my independent daily-bar version (below) disagreed on crude oil and only on crude oil.&lt;/p&gt;

&lt;p&gt;Signal levels, on the other hand, only use &lt;strong&gt;completed&lt;/strong&gt; daily bars: the 20-day and 55-day highs are calculated up to yesterday's close, and N is the value from the last Monday. Nothing inside the day can change today's levels.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the code look like?
&lt;/h2&gt;

&lt;p&gt;The pyramiding rule is a good example of how small the core is. This is the function that adds a unit to a position:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;comm_in&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;half&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;units&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;half&lt;/span&gt;
    &lt;span class="n"&gt;stop&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fill&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;units&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Unit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;comm_in&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sl0&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next_add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fill&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;half&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three lines carry the whole rule: raise the old stops by half N, put the new unit's stop 2N below its real fill, and set the next add level half N further on. Because each unit keeps its own stop, the gap case from part 2 (a unit filling at 30.80 instead of 30.10) falls out naturally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8vmsbq4u4tguhl3ca209.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8vmsbq4u4tguhl3ca209.png" alt="The add function with the new-unit stop highlighted" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The harder code is everything around it: the order of events within one minute (imaginary filter trades first, then stops, then channel exits, then new entries, then adds), the strongest-market rule when several markets trigger in the same minute, and the bookkeeping for swap (charged triple on Wednesdays, every night for bitcoin).&lt;/p&gt;

&lt;h2&gt;
  
  
  How do I know the code is right?
&lt;/h2&gt;

&lt;p&gt;I don't trust a backtest number until the code has been checked in ways that don't depend on the result. Three checks:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Tests from the original PDF.&lt;/strong&gt; Eight tests rebuild the worked examples in the rules document: the heating oil unit size, the N table, the crude oil stops including the gap case, the gold add levels, and the drawdown rule's 10%/20% steps. If the code disagrees with the PDF's own numbers, a test fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. A look-ahead check.&lt;/strong&gt; The simulator is run twice: once on the full data, once with the data cut off at a date (17 March 2021, 2 August 2021, 12 January 2022), so nothing after that date is even loaded. Every trade that opened or closed before the cut has to be identical in both runs: same time, direction, price and size. They are. If any future price leaked into a decision, this would break.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. An independent second version.&lt;/strong&gt; I wrote a separate, much simpler implementation that only uses daily bars, on one market at a time, and compared trades:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Market&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;XAUUSD&lt;/td&gt;
&lt;td&gt;same trades, same direction, same entries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;USDCAD&lt;/td&gt;
&lt;td&gt;same trades&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DE30&lt;/td&gt;
&lt;td&gt;same trades&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;USOIL&lt;/td&gt;
&lt;td&gt;35 vs 32 trades, from the order of prices inside the day&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Long entries differ by exactly the spread, because the daily version ignores it. The only real disagreement is crude oil, which is the intraday-order problem above.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn6is7fkkwnki3qnhpm49.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn6is7fkkwnki3qnhpm49.png" alt="The three checks: tests, the cut-date look-ahead check, and the daily-bar cross-check" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All 11 tests (the 8 rule tests plus 3 cut dates) pass in about 14 seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does a real Turtle trade look like?
&lt;/h2&gt;

&lt;p&gt;Textbook examples are tidy. Here's a real System 2 long on gold from the 26-market run:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Unit&lt;/th&gt;
&lt;th&gt;Entry&lt;/th&gt;
&lt;th&gt;Exit&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;3 Feb 2025 at 2,817.34&lt;/td&gt;
&lt;td&gt;14 May at 3,201.92 (20-day low)&lt;/td&gt;
&lt;td&gt;+$1,326.99&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;4 Feb at 2,832.65&lt;/td&gt;
&lt;td&gt;14 May at 3,201.92&lt;/td&gt;
&lt;td&gt;+$950.92&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;30 Mar at 3,092.86&lt;/td&gt;
&lt;td&gt;stopped 4 Apr at 3,031.63&lt;/td&gt;
&lt;td&gt;−$193.38&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;10 Apr at 3,169.39&lt;/td&gt;
&lt;td&gt;14 May at 3,201.92&lt;/td&gt;
&lt;td&gt;+$31.93&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Total: &lt;strong&gt;+$2,116.46&lt;/strong&gt;, after swap and commission. Two things are not in any textbook. Unit 3 came in eight weeks after unit 2, far beyond half N, because adds were blocked by the portfolio's unit limits while other markets held risk, and each blocked add moved the next level half N further out. And unit 3 was stopped on its own in early April while units 1 and 2 kept running, because its stop was 2N below its own, much higher fill.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fevkdn1c2e4t78rxzikxq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fevkdn1c2e4t78rxzikxq.png" alt="A real System 2 gold trade from February to May 2025 with four units and one stopped on its own" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I can't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real execution.&lt;/strong&gt; This is a simulation on archive data. Real fills at breakouts would see slippage the spread doesn't capture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap and some commissions.&lt;/strong&gt; Swap is measured on 3 of 26 markets; commission on the commodity and index CFDs isn't confirmed. Both are set to zero where unknown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contract sizes&lt;/strong&gt; for some commodities and indices. With risk sized by N this mostly affects lot rounding, not the result in dollars per unit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The archive itself.&lt;/strong&gt; I've compared Exness archive ticks against a live MT5 feed before: about 23% of gold ticks are shifted by up to roughly 30 cents, in both directions. That doesn't matter at 2N stops measured in tens of dollars, but it's worth knowing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, &lt;a href="https://moonthetrain.com/lab/turtle-trading-backtest-results" rel="noopener noreferrer"&gt;part 4: the results&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Research, not financial advice. Past results do not predict future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Turtle Trading Rules Explained: N, Units, Breakouts, Stops</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Fri, 23 Oct 2026 00:58:13 +0000</pubDate>
      <link>https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg</link>
      <guid>https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; The Turtle trading rules are a complete, mechanical trend-following system: Donchian channel breakouts for entries, position size set by volatility (N), a new unit every half N while the trade works, a stop 2N away, and an exit on the opposite channel. Four layers of risk limits sit on top. This post goes through each rule as the 2003 "Original Turtle Trading Rules" PDF states it, with its own worked examples, and then lists the six places where the PDF leaves you to decide.&lt;/p&gt;

&lt;p&gt;This is part 2 of 5. &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-the-1983-experiment-tested-in-2026-1iop"&gt;Part 1&lt;/a&gt; covered the 1983 experiment. In my backtest on 26 Exness markets (2020 to 2026) these exact rules lost 57.7%; parts 3 and 4 show how I built the test and what came out of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is N in the Turtle system?
&lt;/h2&gt;

&lt;p&gt;N is the average daily range, and almost every other rule is written in units of it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;True range = max(High − Low, High − previous Close, previous Close − Low)
N          = (19 × previous N + today's true range) / 20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a 20-day Wilder average of true range, which is what most charting tools call ATR(20). The first N is a simple average of the first 20 true ranges. True range counts gaps, so a market that opens far from yesterday's close gets a larger N even if the day itself is quiet.&lt;/p&gt;

&lt;p&gt;One detail most code gets wrong: the Turtles recalculated N and their position sizes &lt;strong&gt;once a week, on Monday&lt;/strong&gt;, not on every bar. I did the same.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2weh7rfw03rift4phxnq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2weh7rfw03rift4phxnq.png" alt="N on real gold daily bars, late October 2024: N about $31 a day" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How big is one Turtle unit?
&lt;/h2&gt;

&lt;p&gt;One unit is sized so that a move of 1N equals 1% of the account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Unit = 1% of account / (N × dollars per point)      (rounded down)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The PDF's own example is heating oil: N = 0.0141, $42,000 per point, a $1,000,000 account. That's 0.01 × 1,000,000 / (0.0141 × 42,000) = 16.88, so &lt;strong&gt;16 contracts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The effect is that every unit carries the same risk in every market. A quiet market gets more contracts, a wild one fewer. It also means small accounts struggle: the same heating oil example on $100,000 leaves you with 1 contract, and rounding starts to dominate.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F29f9e1dso2qvl5guq4d6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F29f9e1dso2qvl5guq4d6.png" alt="Unit sizing: more contracts in a quiet market, fewer in a wild one, the same 1% risk per N" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the two Turtle entry systems?
&lt;/h2&gt;

&lt;p&gt;Both are breakouts, both enter long or short.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Entry&lt;/th&gt;
&lt;th&gt;Exit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;System 1&lt;/td&gt;
&lt;td&gt;20-day high (long) / 20-day low (short)&lt;/td&gt;
&lt;td&gt;10-day low / 10-day high&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System 2&lt;/td&gt;
&lt;td&gt;55-day high / 55-day low&lt;/td&gt;
&lt;td&gt;20-day low / 20-day high&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A breakout means price trades one tick beyond the high or low of the &lt;strong&gt;previous&lt;/strong&gt; N days, not counting today. The Turtles entered &lt;strong&gt;during the day&lt;/strong&gt;, the moment price crossed, not at the close. If the market opened beyond the level, they filled at the open.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpgd6bn3npzigelfih15i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpgd6bn3npzigelfih15i.png" alt="System 1 and System 2 breakout levels on real gold daily bars, Nov 2024 to Mar 2025" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the System 1 breakout filter?
&lt;/h2&gt;

&lt;p&gt;This is the rule most implementations get wrong.&lt;/p&gt;

&lt;p&gt;System 1 skips a breakout &lt;strong&gt;if the last 20-day breakout would have been a winner&lt;/strong&gt;. "Last" means the last one, whether you took it or not, so you have to track imaginary trades. Direction doesn't matter: a losing short last time means you can take a long this time. A breakout counts as a loss if price moved 2N against it before a profitable 10-day exit.&lt;/p&gt;

&lt;p&gt;Then there's the failsafe. If you skipped a 20-day breakout and price keeps going to a &lt;strong&gt;55-day&lt;/strong&gt; breakout, you enter anyway, so the filter can't make you miss a big trend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frvkuaabzucv5l3da76c2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frvkuaabzucv5l3da76c2.png" alt="The System 1 filter: a winning imaginary breakout, a skipped breakout, and the 55-day failsafe" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Turtle pyramiding work?
&lt;/h2&gt;

&lt;p&gt;The Turtles never bought the full position at once. They added one unit every &lt;strong&gt;half N&lt;/strong&gt; in their favour, measured from the actual fill of the previous unit, up to 4 units per market. All four can go in on the same day.&lt;/p&gt;

&lt;p&gt;The PDF's crude oil example, N = 1.20:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;th&gt;Units at&lt;/th&gt;
&lt;th&gt;Stop for the whole position&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Unit 1&lt;/td&gt;
&lt;td&gt;28.30&lt;/td&gt;
&lt;td&gt;25.90&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unit 2&lt;/td&gt;
&lt;td&gt;28.90&lt;/td&gt;
&lt;td&gt;26.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unit 3&lt;/td&gt;
&lt;td&gt;29.50&lt;/td&gt;
&lt;td&gt;27.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unit 4&lt;/td&gt;
&lt;td&gt;30.10&lt;/td&gt;
&lt;td&gt;27.70&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9sxsxsmenhg7dlv0aj7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9sxsxsmenhg7dlv0aj7t.png" alt="Pyramiding on the crude oil example: four units half an N apart, the stop rising with each one" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where do the Turtles put the stop?
&lt;/h2&gt;

&lt;p&gt;The stop is &lt;strong&gt;2N&lt;/strong&gt; from entry, which is 2% of the account per unit. Every time a unit is added, the stops of the earlier units move up by half N, so the whole position exits 2N below the newest unit.&lt;/p&gt;

&lt;p&gt;There's a subtle case. If price gaps past an add level, say unit 4 fills at 30.80 instead of 30.10, unit 4 gets its own stop at 28.40 (2N below its real fill) while units 1 to 3 stay at 27.70. My simulator handles this, and part 3 shows a real gold trade where it mattered.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7rayafdjx7ri7qazy1w0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7rayafdjx7ri7qazy1w0.png" alt="The gap case: unit 4 fills at 30.80 and keeps its own stop at 28.40; units 1 to 3 keep 27.70" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The PDF also describes an alternative, the "Whipsaw" stop: half N per unit, re-enter if price comes back to the original entry. It says this made more money but was harder to trade. I didn't test it.&lt;/p&gt;

&lt;h2&gt;
  
  
  When do the Turtles take profit?
&lt;/h2&gt;

&lt;p&gt;They don't, not at a target. System 1 exits on a 10-day low (for longs), System 2 on a 20-day low, all units at once. The PDF calls this the hardest part of the system: you routinely watch 20% to 40% of an open profit disappear, sometimes all of it, before the exit triggers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn3en7nxo79z31zparv64.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn3en7nxo79z31zparv64.png" alt="Exits on the 10-day and 20-day lows, and the open profit given back before them" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the Turtle risk limits?
&lt;/h2&gt;

&lt;p&gt;Risk is capped in units:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Max units&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;One market&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Closely related markets, same direction&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Loosely related markets, same direction&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;One direction overall&lt;/td&gt;
&lt;td&gt;12 long and 12 short&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On top of that is the drawdown rule. Every time the account falls 10% below its value at the start of the year, you trade as if it were 20% smaller. Lose $100,000 of $1,000,000 and you size for $800,000; lose another $80,000 and you size for $640,000. That stays in place until the account gets back to its start-of-year level.&lt;/p&gt;

&lt;p&gt;When several markets break out at once, the PDF says to take the strongest one, measured for example by (price − price 3 months ago) / N. I used that to decide which order signals are filled in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogtdn0q4ccxtbo3tian8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogtdn0q4ccxtbo3tian8.png" alt="The four unit limits and the drawdown rule" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The correlation groups are the one place I had to translate. The 1983 futures list doesn't map onto a modern CFD basket, so I grouped markets myself: EURUSD, GBPUSD and USDCHF as closely related (USDCHF with the sign flipped), AUDUSD with NZDUSD, AUDCAD with NZDCAD, US and UK oil, gold with silver, DE30 with STOXX50. Looser groups cover all USD pairs, the AUD/NZD pairs, energy, metals and stock indices.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the original PDF leave open?
&lt;/h2&gt;

&lt;p&gt;Six things, and you have to pick an answer for each before you can write code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Do System 1 and System 2 share the 4-unit limit?&lt;/strong&gt; I count them together, split capital 50/50 between them, and don't allow the two systems to hold opposite directions in the same market.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is the exit checked intraday or on the close?&lt;/strong&gt; Intraday, as the PDF describes. Some published versions use the close.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does the imaginary trade for the filter pyramid?&lt;/strong&gt; No. It's a loss if it hits −2N first, otherwise it's judged at its 10-day exit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What if one day touches both a stop and an entry?&lt;/strong&gt; I decide from minute data, and if a single minute bar touches both, the stop goes first (the conservative choice).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What happens to a signal blocked by a limit?&lt;/strong&gt; The entry is skipped for that day; a blocked add moves its level another half N out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How is the account reset each year?&lt;/strong&gt; The notional account is set to equity at the start of each year. Dennis adjusted it by judgment; this is the mechanical version.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Should Turtle trading use shorter timeframes today?
&lt;/h2&gt;

&lt;p&gt;A common idea: markets move faster now, so daily bars are too slow and an hourly chart would be the modern equivalent. I don't think that works, and the cost side alone shows why.&lt;/p&gt;

&lt;p&gt;The spread stays about the same on every timeframe, but N shrinks as the bars get shorter. Here's gold on Exness Raw Spread, medians from 2020 to 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Timeframe&lt;/th&gt;
&lt;th&gt;Median spread&lt;/th&gt;
&lt;th&gt;Median N&lt;/th&gt;
&lt;th&gt;Spread as % of N&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;D1&lt;/td&gt;
&lt;td&gt;$0.067&lt;/td&gt;
&lt;td&gt;$25.78&lt;/td&gt;
&lt;td&gt;0.30%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H4&lt;/td&gt;
&lt;td&gt;$0.064&lt;/td&gt;
&lt;td&gt;$10.57&lt;/td&gt;
&lt;td&gt;0.69%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H1&lt;/td&gt;
&lt;td&gt;$0.063&lt;/td&gt;
&lt;td&gt;$5.45&lt;/td&gt;
&lt;td&gt;1.33%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;M15&lt;/td&gt;
&lt;td&gt;$0.063&lt;/td&gt;
&lt;td&gt;$2.67&lt;/td&gt;
&lt;td&gt;2.68%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every entry and exit pays the spread, and a breakout system trades far more often on shorter bars. So costs per unit of risk are about 4 times heavier on H1 and 9 times heavier on M15. On top of that, research on trend following (Moskowitz, Ooi and Pedersen, 2012, 58 markets) found the effect strongest over 1 to 12 month lookbacks, not hours. So I kept daily bars, as written.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuqcmnlhm0htim9aj3x4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuqcmnlhm0htim9aj3x4x.png" alt="Spread as a percentage of N on gold for D1, H4, H1 and M15, Exness Raw Spread medians 2020 to 2026" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I can't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How the Turtles traded in practice.&lt;/strong&gt; I follow the PDF. Individual Turtles adapted the rules, and the PDF itself says some of them did.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The futures side.&lt;/strong&gt; I tested CFDs on Exness, not the 1983 futures list. There's no contract roll, but there is overnight swap, which I've only measured on 3 of the 26 markets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Whipsaw stop.&lt;/strong&gt; Not tested.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, &lt;a href="https://moonthetrain.com/lab/turtle-trading-python-backtest" rel="noopener noreferrer"&gt;part 3&lt;/a&gt; covers the Python simulator and the three checks that tell me the losses in &lt;a href="https://moonthetrain.com/lab/turtle-trading-backtest-results" rel="noopener noreferrer"&gt;part 4&lt;/a&gt; aren't a coding bug.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Research, not financial advice. Past results do not predict future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Turtle Trading Rules: The 1983 Experiment, Tested in 2026</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Thu, 22 Oct 2026 03:00:13 +0000</pubDate>
      <link>https://dev.to/moonthetrain/turtle-trading-rules-the-1983-experiment-tested-in-2026-1iop</link>
      <guid>https://dev.to/moonthetrain/turtle-trading-rules-the-1983-experiment-tested-in-2026-1iop</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; The Turtle trading experiment is the most famous story in trend following: in 1983 Richard Dennis picked 13 people through newspaper ads, trained them for two weeks, and gave them real money. According to the original rules document, they averaged about 80% a year for four years. I coded every one of those rules and ran them on Exness tick data, 26 markets, January 2020 to September 2026. A $100,000 account ended at &lt;strong&gt;$42,299 (−57.7%)&lt;/strong&gt;, with a &lt;strong&gt;75.6% drawdown&lt;/strong&gt; on the way.&lt;/p&gt;

&lt;p&gt;This is part 1 of 5. It covers the experiment itself and how I'm testing it. The rules, the code, the full results and the lessons each get their own post.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2zrrxvia3rs9re41duf7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2zrrxvia3rs9re41duf7.png" alt="Equity curve of the original Turtle rules on 26 Exness markets, Jan 2020 to Sep 2026, $100,000 start, ending at $42,299" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What was the Turtle trading experiment?
&lt;/h2&gt;

&lt;p&gt;It started as an argument between two partners. Richard Dennis was a well-known commodity trader in Chicago. His partner, William Eckhardt, traded alongside him. Dennis thought trading could be taught like any other skill. Eckhardt thought good traders were born with something you couldn't hand to anyone else.&lt;/p&gt;

&lt;p&gt;In mid-1983 they made a bet to settle it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F05wkcgqn2fxlc9yiv3ee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F05wkcgqn2fxlc9yiv3ee.png" alt="Richard Dennis versus William Eckhardt: traders can be taught versus traders are born, and the steps of the 1983 experiment" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How were the Turtles chosen?
&lt;/h2&gt;

&lt;p&gt;Dennis ran ads in Barron's, the Wall Street Journal and the New York Times. More than 1,000 people applied. About 80 were interviewed, 10 were selected, and Dennis added 3 people he already knew, which made &lt;strong&gt;13 trainees&lt;/strong&gt; in the first class. A second class followed in 1984. Sources disagree on the total, but it's usually put at around 23.&lt;/p&gt;

&lt;p&gt;The training lasted &lt;strong&gt;two weeks&lt;/strong&gt;, at the end of December 1983. In January 1984 the trainees traded small accounts. From February, most of them were trading between $500,000 and $2 million of Dennis's money.&lt;/p&gt;

&lt;p&gt;The name came from Dennis himself. He'd just been to Asia and, as the Wall Street Journal reported in 1989, said they were going to grow traders the way Singapore grows turtles on farms.&lt;/p&gt;

&lt;h2&gt;
  
  
  How much did the Turtles make?
&lt;/h2&gt;

&lt;p&gt;The original rules document says the group averaged &lt;strong&gt;about 80% a year, compounded, over four years&lt;/strong&gt;. I can't verify that number. It comes from the people who were there, and I haven't found an audited track record for the group. I'm quoting it because it's the claim the legend rests on, not because I've checked it.&lt;/p&gt;

&lt;p&gt;What I can say is that the rules themselves are fully specified, which is rare for a trading legend. You don't have to guess what they did. And that's what makes the story testable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why were the rules secret until 2003?
&lt;/h2&gt;

&lt;p&gt;The Turtles signed an agreement to keep the rules confidential for ten years, which ran out at the end of 1993. After that, versions of the rules started appearing for sale. In 2003, a group of former Turtles put the complete rules online for free as "The Original Turtle Trading Rules" (OriginalTurtles.org), a 34-page PDF. That document is my source for everything in this series. Where other write-ups disagree with it, I follow the PDF.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6f6gspuuo0lxa6vc5ary.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6f6gspuuo0lxa6vc5ary.png" alt="Timeline of the Turtle experiment: about 80% a year from 1984 to 1988 as stated in the original rules, secrecy ends 1993, rules published free in 2003" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dennis is often quoted as saying he could publish his rules in the newspaper and no one would follow them, because the hard part is discipline, not knowledge. So I took him at his word and followed every rule, exactly as written.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do the original Turtle rules still work?
&lt;/h2&gt;

&lt;p&gt;Not on the data I tested. Here's the headline result, original rules with no parameter changes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Basket&lt;/th&gt;
&lt;th&gt;Markets&lt;/th&gt;
&lt;th&gt;Period&lt;/th&gt;
&lt;th&gt;Positions&lt;/th&gt;
&lt;th&gt;End equity&lt;/th&gt;
&lt;th&gt;Return&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;th&gt;Profit factor&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;11 markets&lt;/td&gt;
&lt;td&gt;forex, gold, S&amp;amp;P 500, bitcoin&lt;/td&gt;
&lt;td&gt;Jan 2020 – Sep 2026&lt;/td&gt;
&lt;td&gt;834&lt;/td&gt;
&lt;td&gt;$62,136&lt;/td&gt;
&lt;td&gt;−37.9%&lt;/td&gt;
&lt;td&gt;58.3%&lt;/td&gt;
&lt;td&gt;0.89&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;26 markets&lt;/td&gt;
&lt;td&gt;+ oil, gas, silver, platinum, copper, 6 stock indices&lt;/td&gt;
&lt;td&gt;Jan 2020 – Sep 2026&lt;/td&gt;
&lt;td&gt;1,232&lt;/td&gt;
&lt;td&gt;$42,299&lt;/td&gt;
&lt;td&gt;−57.7%&lt;/td&gt;
&lt;td&gt;75.6%&lt;/td&gt;
&lt;td&gt;0.83&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both baskets start with $100,000 and risk 1% of equity per unit, as the rules say. Profit factor is per position (all units of one trade together), and drawdown is measured on daily equity.&lt;/p&gt;

&lt;p&gt;Adding markets made it worse, not better. And the split by direction is the most interesting part: on 26 markets, long trades made about $28,279 while short trades lost about $85,989. Part 4 goes through that in detail, including why I'm not simply dropping the shorts.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I'm testing the rules
&lt;/h2&gt;

&lt;p&gt;This isn't a spreadsheet of daily closes. Here's the setup, briefly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; Exness Raw Spread tick archive, turned into M1 and D1 bars. Real spreads from the archive. Commission at Exness Raw Spread rates on forex, gold and bitcoin; on the newer commodity and index markets I haven't confirmed it, so it's set to zero.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Period:&lt;/strong&gt; January 2020 to September 2026, about 6.7 years.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signals:&lt;/strong&gt; Donchian breakouts on completed daily bars, exactly as in the original rules (System 1 at 20 days with its filter and the 55-day failsafe, System 2 at 55 days).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fills:&lt;/strong&gt; checked minute by minute, so a day that touches both an entry and a stop is handled in the order it actually happened.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio:&lt;/strong&gt; one shared account across all markets, with the unit limits (4 per market, 6 for closely related markets, 10 for loosely related ones, 12 per direction) and the drawdown rule that trades a smaller account after a 10% loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checks:&lt;/strong&gt; tests built from the worked examples in the PDF, a look-ahead check that cuts the data at three dates, and a second, independent version on daily bars that matched trade for trade on three markets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn't optimise anything. The point is to test the rules as published, not to find settings that would have worked on this particular stretch of history.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this series covers
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The 1983 experiment&lt;/strong&gt; (this post)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The full rules:&lt;/strong&gt; N, unit sizing, both entry systems, pyramiding, stops, exits, portfolio limits, and why I didn't move to faster timeframes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building the simulator,&lt;/strong&gt; and the three checks that tell me the losses aren't a coding bug&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The results:&lt;/strong&gt; 11 markets, then 26, one rule switched off at a time, and the long-short split&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What I learned,&lt;/strong&gt; and the limits of this test&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There's also a 7-minute video version on the way, with the same numbers drawn from the same data.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I can't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The 80% a year.&lt;/strong&gt; It's the rules document's own claim about its authors. I haven't seen an audited record.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The history.&lt;/strong&gt; Numbers like 1,000 applicants or 23 Turtles in total come from the PDF and from later interviews and books. Sources disagree on some of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap and some commissions.&lt;/strong&gt; I've measured swap on 3 of the 26 markets. On the rest it's set to zero, and so is commission on the commodity and index markets. Trend trades are held for weeks, so the real results would likely be a bit worse than the table above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Earlier decades.&lt;/strong&gt; My data starts in 2020. Six and a half years is a short window for a trend system, and I'm not claiming anything about the 1980s or the 2000s.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're interested in how another classic trend tool held up on the same data, I ran the &lt;a href="https://moonthetrain.com/lab/tradingview-supertrend-strategy-backtest" rel="noopener noreferrer"&gt;TradingView SuperTrend strategy on 6.7 years of Exness ticks&lt;/a&gt; as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bottom line:&lt;/strong&gt; the Turtle experiment may well have worked in the 1980s, but the published rules lost 57.7% on 26 Exness markets from 2020 to 2026. &lt;a href="https://dev.to/moonthetrain/turtle-trading-rules-explained-n-units-breakouts-stops-25hg"&gt;Part 2&lt;/a&gt; goes through those rules one by one.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Research, not financial advice. Past results do not predict future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>I expected Jev to remember 2025. It doesn't know Trump was inaugurated</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sun, 11 Oct 2026 00:23:04 +0000</pubDate>
      <link>https://dev.to/moonthetrain/i-expected-jev-to-remember-2025-it-doesnt-know-trump-was-inaugurated-4ifd</link>
      <guid>https://dev.to/moonthetrain/i-expected-jev-to-remember-2025-it-doesnt-know-trump-was-inaugurated-4ifd</guid>
      <description>&lt;p&gt;&lt;strong&gt;I expected Jev to have learned the outcomes of old prediction markets. It hasn't.&lt;/strong&gt; Asked "Will Donald Trump be inaugurated?" about the January 2025 market, Jev says 0.70. Asked whether the Fed raised rates in January 2025, it says 0.30, the same number it gives almost everything. Across 17,036 Polymarket markets resolved up to 20 months before its release, Jev's ability to rank Yes from No (AUC 0.59–0.68) is the same as on 9,138 markets resolved after it, which it cannot have seen. For anyone backtesting a Jev bot on history, that's the opposite of what I warned about in &lt;a href="https://moonthetrain.com/lab/jev-trading-verdict" rel="noopener noreferrer"&gt;my Jev trading verdict&lt;/a&gt;, and good news.&lt;/p&gt;

&lt;p&gt;This is the side result of &lt;a href="https://moonthetrain.com/lab/can-jev-beat-polymarket" rel="noopener noreferrer"&gt;part 1&lt;/a&gt;, where Jev lost to the market price on every measure. It deserves its own post because I got it wrong in advance, and because it changes what a backtest with Jev is worth.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I expected, and why
&lt;/h2&gt;

&lt;p&gt;Jev is trained on text. The outcomes of 2025's big markets are everywhere in text: who was inaugurated, what the Fed did in every meeting, who won Wimbledon, whether there was a ceasefire. A general language model answers those from memory, and a market question that names the event and the date is as direct a cue as you can give.&lt;/p&gt;

&lt;p&gt;So my assumption going in, written down in my earlier Jev verdict, was that any Jev result on historical markets would be contaminated: the model would "predict" 2025 from memory, look brilliant, and fall apart live. I had seen the same pattern discussed for LLM-based trading backtests, and it's the first thing a reviewer asks about.&lt;/p&gt;

&lt;p&gt;The test design followed from that. Instead of only scoring markets resolved after Jev's release, I pulled five earlier months too, all the way back to January 2025, and asked the same question in the same way. If Jev remembers, the old months must score far higher.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsogakzpdxh1fyvnmr47w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsogakzpdxh1fyvnmr47w.png" alt="Timeline of the six resolution months from January 2025 to October 2026 with the release date of jev-1.13.0 marked; Jev's AUC is written above each month and is roughly the same on both sides" width="800" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How the check works
&lt;/h2&gt;

&lt;p&gt;Same pipeline as part 1, one loop more. Each market's reference time (the earlier of its end date and resolution time) puts it in a window, and every window is scored on its own:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.metrics&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;roc_auc_score&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;window&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2025-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2025-07&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2026-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2026-04&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2026-07&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2026-09&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;dataset&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;window&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;y&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;          &lt;span class="c1"&gt;# resolved Yes = 1
&lt;/span&gt;    &lt;span class="n"&gt;p_mkt&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;p_24h&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;      &lt;span class="c1"&gt;# Yes price 24 h before
&lt;/span&gt;    &lt;span class="n"&gt;p_jev&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jev_blind&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;  &lt;span class="c1"&gt;# Jev, question + rules only
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;roc_auc_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p_mkt&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;roc_auc_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p_jev&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The state Jev sees is only the question and the resolution rules, with their dates left in. That's deliberate. If the model had any memory of these events, the date in "after the January 2025 meeting" is exactly the cue that should trigger it. Blinding the dates would have hidden the thing I was trying to detect.&lt;/p&gt;

&lt;p&gt;Jev was released on 10 September 2026. The last window, 10 September to 10 October 2026, can't be in its training data. Everything before could be.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I found
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Markets resolved in&lt;/th&gt;
&lt;th&gt;Markets&lt;/th&gt;
&lt;th&gt;AUC market price&lt;/th&gt;
&lt;th&gt;AUC Jev (95% CI)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;January 2025&lt;/td&gt;
&lt;td&gt;1,102&lt;/td&gt;
&lt;td&gt;0.942&lt;/td&gt;
&lt;td&gt;0.676 (0.638–0.714)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;July 2025&lt;/td&gt;
&lt;td&gt;1,696&lt;/td&gt;
&lt;td&gt;0.918&lt;/td&gt;
&lt;td&gt;0.586 (0.556–0.618)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;January 2026&lt;/td&gt;
&lt;td&gt;9,511&lt;/td&gt;
&lt;td&gt;0.924&lt;/td&gt;
&lt;td&gt;0.661 (0.649–0.673)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;April 2026 (sample)&lt;/td&gt;
&lt;td&gt;2,340&lt;/td&gt;
&lt;td&gt;0.853&lt;/td&gt;
&lt;td&gt;0.625 (0.599–0.648)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;July 2026 (sample)&lt;/td&gt;
&lt;td&gt;2,387&lt;/td&gt;
&lt;td&gt;0.860&lt;/td&gt;
&lt;td&gt;0.636 (0.613–0.660)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10 Sep – 10 Oct 2026, after release&lt;/td&gt;
&lt;td&gt;9,138&lt;/td&gt;
&lt;td&gt;0.844&lt;/td&gt;
&lt;td&gt;0.615 (0.603–0.627)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Flat. January 2025 is a bit above the latest month, July 2025 a bit below, and all of them sit in the same band of "a little better than a coin flip". A model that remembered 2025 would be near the market's 0.94 on that row, not at 0.68.&lt;/p&gt;

&lt;p&gt;The high-volume markets make it concrete. These are the events everyone followed, with Jev's answer next to the price:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Market, January 2025&lt;/th&gt;
&lt;th&gt;Price 24 h before&lt;/th&gt;
&lt;th&gt;Jev&lt;/th&gt;
&lt;th&gt;Resolved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Will Donald Trump be inaugurated?&lt;/td&gt;
&lt;td&gt;0.99&lt;/td&gt;
&lt;td&gt;0.70&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will Biden finish his term?&lt;/td&gt;
&lt;td&gt;0.99&lt;/td&gt;
&lt;td&gt;0.57&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No change in Fed interest rates after January 2025 meeting?&lt;/td&gt;
&lt;td&gt;0.98&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fed increases interest rates by 25+ bps after January 2025 meeting?&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;td&gt;0.30&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fed decreases interest rates by 50 bps after January 2025 meeting?&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;td&gt;0.41&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Democrats win popular vote by 7% or more?&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;td&gt;0.37&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Market, July 2025&lt;/th&gt;
&lt;th&gt;Price 24 h before&lt;/th&gt;
&lt;th&gt;Jev&lt;/th&gt;
&lt;th&gt;Resolved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No change in Fed interest rates after July 2025 meeting?&lt;/td&gt;
&lt;td&gt;0.97&lt;/td&gt;
&lt;td&gt;0.50&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fed increases interest rates by 25+ bps after July 2025 meeting?&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;td&gt;0.39&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will Jannik Sinner win Wimbledon 2025?&lt;/td&gt;
&lt;td&gt;0.47&lt;/td&gt;
&lt;td&gt;0.31&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will Carlos Alcaraz win Wimbledon 2025?&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.29&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Israel x Hamas ceasefire before August?&lt;/td&gt;
&lt;td&gt;0.01&lt;/td&gt;
&lt;td&gt;0.24&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Trump's inauguration at 0.70 is the highest number Jev gave any of these, and it's the one place something like recall shows through. Everything else is the same 0.3-to-0.5 fog it gives a market it has never heard of. It assigns the Fed hiking by 25 bps in January 2025 a 0.30 and the Fed holding a 0.54, when the first was impossible and the second certain to anyone who had read a newspaper that month.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one place memory shows: sports
&lt;/h2&gt;

&lt;p&gt;Splitting each month by Jev's own category label gives the only wrinkle in the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc40wc025fuvx8577n0yo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc40wc025fuvx8577n0yo.png" alt="Bar chart of AUC by month for the market price, Jev on sports markets and Jev on all other markets; Jev's sports AUC is 0.79 in both 2025 months and 0.60 to 0.69 in 2026" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On sports markets Jev scores 0.79 in both 2025 months and 0.60–0.69 in every 2026 month, including the one after its release. On everything else it's 0.52–0.65 with no trend at all. Two readings fit. Either Jev has absorbed some famous 2025 results (champions, playoff winners) and none of the political or economic ones, or 2025's sports markets were simply a different mix, with more season-long "will X win the title" questions where a strong favourite is easier to guess. I can't separate the two with this data, so I'd call it a hint, not a finding. It's also the one category where I'd be careful backtesting on 2025.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it might be this way
&lt;/h2&gt;

&lt;p&gt;I can only guess, and I want to be clear that's what this is. Jev is sold as a "System One" model: fast, calibrated judgment on the state you give it, trained to return decisions rather than text. The model card says it struggles with indirection and numeric precision and reads literally. A model optimised that way may simply not carry much episodic world knowledge, or may not be able to connect "January 2025 meeting" to a stored fact the way a chat model does. Its answer to "will this happen?" looks like a prior over the &lt;em&gt;kind&lt;/em&gt; of question (Fed hikes are rare, incumbents usually finish terms), not a lookup of what happened.&lt;/p&gt;

&lt;p&gt;That's consistent with my earlier Jev tests. In the &lt;a href="https://moonthetrain.com/lab/can-jev-predict-bitcoin" rel="noopener noreferrer"&gt;Bitcoin test&lt;/a&gt; Jev read Bitcoin indicators the way a textbook would. Here it reads market questions the way a textbook would. It has general knowledge about how the world tends to go and little memory of how it actually went.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this changes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Backtesting Jev on old prediction markets is not leaky, at least not for jev-1.13.0.&lt;/strong&gt; If you build a filter that calls Jev on historical Polymarket markets and measure whether the ones it keeps resolve better, the number you get is roughly the number you'll get live. I expected to have to tell people the opposite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It also closes a door.&lt;/strong&gt; A common hope for a text model in a trading bot is that it "knows things": base rates, who the favourite is, what usually happens after a Fed hold. Jev's answers on these markets show that whatever it knows, it isn't enough to move its probability away from 0.3 for events the whole world watched. Don't use it as a knowledge source. Give it the knowledge in the state and let it read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And it keeps the main result of part 1 honest.&lt;/strong&gt; If Jev had scored 0.9 on 2025 and 0.6 on 2026, the 0.6 would still be the real number, but every earlier result would have needed a long caveat about every earlier claim. Instead the number is 0.6 everywhere, which is dull and clean.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I couldn't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One phrasing, one model.&lt;/strong&gt; A question phrased as "Did the Fed raise rates in January 2025?" (past tense, as a fact) might score differently from the market's wording. I kept the market's wording because that's what a bot would send.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The sports hint.&lt;/strong&gt; 0.79 against 0.66 on a few hundred markets is suggestive, not proof.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training cutoff.&lt;/strong&gt; TypeSafe doesn't publish one. If the real cutoff is earlier than I assume, the 2026 windows aren't a memorisation test at all, but January and July 2025 still are, and they're the flattest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only Polymarket questions.&lt;/strong&gt; A model may remember events without being able to map a market's wording onto them. That's a limit of Jev as a bot component either way.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code and data pipeline: &lt;a href="https://github.com/truongxxxx/jev-polymarket-test" rel="noopener noreferrer"&gt;github.com/truongxxxx/jev-polymarket-test&lt;/a&gt;. Rerunning the whole memorisation check costs about a dollar in Jev calls and an hour of API downloads, and the scripts resume where they stopped.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>Can Jev beat Polymarket? I asked it about 26,174 resolved markets</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sun, 11 Oct 2026 00:22:42 +0000</pubDate>
      <link>https://dev.to/moonthetrain/can-jev-beat-polymarket-i-asked-it-about-26174-resolved-markets-2llb</link>
      <guid>https://dev.to/moonthetrain/can-jev-beat-polymarket-i-asked-it-about-26174-resolved-markets-2llb</guid>
      <description>&lt;p&gt;&lt;strong&gt;Can Jev beat the Polymarket price? Not from the question text, no.&lt;/strong&gt; I sent Jev the question and resolution rules of 26,174 resolved Polymarket markets and asked one thing: will this resolve Yes? On the 9,138 markets resolved after Jev's release, so nothing it could have seen in training, it scored an AUC of 0.615. The Yes price traded a day before scored 0.844. Telling Jev the price made it worse than the price. Blending the two added nothing. And Jev answered "more likely Yes than No" on 2.4% of the markets, because it mostly says 0.3 to everything.&lt;/p&gt;

&lt;p&gt;This part is the main result, with the code. The side result I didn't expect, that Jev doesn't remember old market outcomes either, gets its own write-up in &lt;a href="https://moonthetrain.com/lab/jev-does-not-remember-the-past" rel="noopener noreferrer"&gt;part 2&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this test
&lt;/h2&gt;

&lt;p&gt;In the last part of my earlier series, &lt;a href="https://moonthetrain.com/lab/jev-trading-verdict" rel="noopener noreferrer"&gt;Jev in trading, tested&lt;/a&gt;, I wrote that Jev had failed every price-only test I'd run, but that I hadn't tested a task where the information isn't in the price. Prediction markets are the obvious candidate. Each market is a sentence in plain English plus a page of resolution rules, which is exactly the kind of input Jev is built for. And "use Jev to find mispriced Polymarket markets" is a popular pitch right now: scan thousands of markets in code, let Jev judge which ones are worth a trade, size and execute in code.&lt;/p&gt;

&lt;p&gt;Polymarket also publishes everything I need to check that pitch: every resolved market, its text, and its full price history. Nobody paid me for this and I don't sell anything built on Jev.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I tested it
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbfqvzu9qmtj4x7e4cbjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbfqvzu9qmtj4x7e4cbjn.png" alt="Pipeline of the test: resolved markets from the Gamma API, price snapshot from the CLOB history, state for Jev, Jev's two questions, then scoring, paper trades and a memorisation check" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Markets&lt;/td&gt;
&lt;td&gt;Resolved Yes/No markets with at least $10k volume, from Polymarket's public Gamma API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;td&gt;Markets resolved in Jan 2025, Jul 2025, Jan 2026, Apr 2026, Jul 2026 (samples) and 10 Sep – 10 Oct 2026 (all 9,138)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Baseline&lt;/td&gt;
&lt;td&gt;Last traded Yes price at least 24 hours before the earlier of end date and resolution time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev input, blind&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;{market_question, resolution_rules}&lt;/code&gt;, rules cut at 1,200 characters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev input, priced&lt;/td&gt;
&lt;td&gt;The same plus the 24-hour-earlier Yes price, labelled as the traders' implied probability&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev questions&lt;/td&gt;
&lt;td&gt;One Noul: "this market resolves Yes"; one Choice: category&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model&lt;/td&gt;
&lt;td&gt;jev-1.13.0, released 2026-09-10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;52,348 requests, 722 input tokens each, about $1.60 in total; median latency 284 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The 24-hour price is a hard baseline on purpose. A bot that wants to beat the market has to beat the market's current price, not a coin flip. The question is whether Jev brings anything the price doesn't already contain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting the markets and the price
&lt;/h3&gt;

&lt;p&gt;The Gamma API returns closed markets with their text and final outcome. I keep the ones UMA actually resolved, with a clean 0/1 outcome and a Yes/No pair:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://gamma-api.polymarket.com/markets?closed=true&amp;amp;limit=100&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
       &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;offset=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;off&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;end_date_min=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;T00:00:00Z&amp;amp;end_date_max=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;next_day&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;T00:00:00Z&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
       &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;volume_num_min=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;min_volume&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;prices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;outcomePrices&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;          &lt;span class="c1"&gt;# e.g. ["0", "1"]
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;umaResolutionStatus&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;resolved&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}:&lt;/span&gt;               &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;outcomes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Yes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;No&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;  &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="nf"&gt;keep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;rules&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="n"&gt;yes_token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clobTokenIds&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="n"&gt;resolved_yes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The price comes from the CLOB history of the Yes token, hourly, over the nine days before the reference time. "24 hours before" means the last trade at or before that moment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ref&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;end_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;closed_time&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                      &lt;span class="c1"&gt;# the event, not the resolution lag
&lt;/span&gt;&lt;span class="n"&gt;hist&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://clob.polymarket.com/prices-history?market=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;yes_token&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
           &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;startTs=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ref&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;86400&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;endTs=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ref&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;fidelity=60&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;history&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;last_before&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hist&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hist&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;t&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;t&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;p&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;

&lt;span class="n"&gt;p_24h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;last_before&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hist&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;86400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;p_7d&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;last_before&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hist&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;86400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Markets younger than a day have no 24-hour price and are dropped. That removes most of the daily crypto and same-day sports markets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Asking Jev
&lt;/h3&gt;

&lt;p&gt;One request per market, two questions. The state is a small JSON object, as the docs recommend, and the Noul is phrased as a statement that is either true or false:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typesafe_sdk&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AsyncTypeSafeClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Choice&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Noul&lt;/span&gt;

&lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;market_question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Will Xi Jinping visit US by September 30?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;resolution_rules&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;This market will resolve to Yes if ...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;# cut at 1,200 chars
&lt;/span&gt;    &lt;span class="c1"&gt;# priced variant adds:
&lt;/span&gt;    &lt;span class="c1"&gt;# "market_price_yes": 0.27,
&lt;/span&gt;    &lt;span class="c1"&gt;# "market_price_note": "Price of one Yes share one day before ... the traders' implied probability",
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;questions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Noul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The prediction market described in the state resolves Yes, meaning the event asked &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;about in market_question happens according to resolution_rules.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Which category does market_question belong to?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;criteria&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sports&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A sports match, game, season, tournament or athlete result&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;crypto_price&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The price of a cryptocurrency reaching, staying above or below a level&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;politics&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Elections, governments, legislation, geopolitics, wars, officials&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;economics&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Central banks, interest rates, macro data, companies, stocks, commodities&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;entertainment&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Movies, music, awards, television, celebrities, culture&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;science_tech&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Technology products, AI models, space launches, science, weather, health&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;other&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Anything that does not fit the categories above&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;AsyncTypeSafeClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jev-latest&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;system_one&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;questions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;p_yes&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nouls&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;noul&lt;/span&gt;          &lt;span class="c1"&gt;# 0..1
&lt;/span&gt;    &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;choice&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The runner sends eight requests at a time and appends every answer to a JSONL file, so a crash or a rate limit just means rerunning the same command. All 52,348 requests went through without a single error, which is more than I can say for most APIs.&lt;/p&gt;

&lt;p&gt;Scoring is the usual for probabilities: Brier score and log loss (lower is better), AUC (can it rank the markets that resolved Yes above the ones that resolved No), and calibration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does Jev beat the price?
&lt;/h2&gt;

&lt;p&gt;No, on any measure.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method, 9,138 markets resolved 10 Sep – 10 Oct 2026&lt;/th&gt;
&lt;th&gt;Brier&lt;/th&gt;
&lt;th&gt;Log loss&lt;/th&gt;
&lt;th&gt;AUC (95% CI)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Always predict the base rate (35% Yes)&lt;/td&gt;
&lt;td&gt;0.227&lt;/td&gt;
&lt;td&gt;0.647&lt;/td&gt;
&lt;td&gt;0.500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Market price, 7 days before (5,229 markets old enough)&lt;/td&gt;
&lt;td&gt;0.170&lt;/td&gt;
&lt;td&gt;0.498&lt;/td&gt;
&lt;td&gt;0.773&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Market price, 24 hours before&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.152&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.450&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.844 (0.836–0.852)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev, question and rules only&lt;/td&gt;
&lt;td&gt;0.220&lt;/td&gt;
&lt;td&gt;0.630&lt;/td&gt;
&lt;td&gt;0.615 (0.603–0.627)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev, told the 24-hour price&lt;/td&gt;
&lt;td&gt;0.190&lt;/td&gt;
&lt;td&gt;0.556&lt;/td&gt;
&lt;td&gt;0.794 (0.785–0.803)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Jev on its own is barely better than guessing the base rate (Brier 0.220 against 0.227). The market a full week out beats it comfortably. And when I handed Jev the price, it tracked it (rank correlation 0.85) but dragged every answer towards its favourite region around 0.3. Its adjustment made the squared error worse on 72.6% of markets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1vvtzveqfdz975xf264m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1vvtzveqfdz975xf264m.png" alt="AUC of the market price and of Jev by resolution month, resolved Polymarket markets, January 2025 to October 2026" width="799" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The same gap holds in every category Jev assigned. It's smallest in sports (0.656 vs 0.774) and largest where the price is almost always right, like crypto price thresholds (0.698 vs 0.971) and politics (0.633 vs 0.956).&lt;/p&gt;

&lt;h2&gt;
  
  
  Jev almost never says Yes
&lt;/h2&gt;

&lt;p&gt;This is the part worth looking at. Here's where the answers land:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5opdsbq7k75r913kh9ce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5opdsbq7k75r913kh9ce.png" alt="Distribution of answers on 9,138 markets: market price spans 0 to 1, Jev clusters between 0.2 and 0.45" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Median&lt;/th&gt;
&lt;th&gt;5th–95th percentile&lt;/th&gt;
&lt;th&gt;Above 0.5&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Market price, 24 h before&lt;/td&gt;
&lt;td&gt;0.27&lt;/td&gt;
&lt;td&gt;0.00–0.94&lt;/td&gt;
&lt;td&gt;23.0% of markets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev, blind&lt;/td&gt;
&lt;td&gt;0.32&lt;/td&gt;
&lt;td&gt;0.20–0.44&lt;/td&gt;
&lt;td&gt;2.4% of markets&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Jev answered between 0.2 and 0.45 for nine markets out of ten, whatever the question. A market priced at 1 cent and a market priced at 99 cents got nearly the same number.&lt;/p&gt;

&lt;p&gt;Within that narrow band it's reasonably calibrated: when it said 0.19 about 17% resolved Yes, when it said 0.47 about 48% did. So it isn't lying. Given a question it can't know the answer to, it returns something close to "a prediction market usually resolves No", which is true (35% resolved Yes here) and useless for picking trades.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogrddk460czbei4r8god.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogrddk460czbei4r8god.png" alt="Calibration on 9,138 markets: the market price runs along the diagonal from 0 to 1, Jev sits on a short segment between 0.19 and 0.47" width="800" height="738"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Does it add anything to the price?
&lt;/h2&gt;

&lt;p&gt;Three checks, all negative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blend.&lt;/strong&gt; A logistic regression on the market's logit and Jev's logit, 5-fold cross-validated, gives Jev a weight of +0.20 and leaves the Brier score at 0.150, the same as recalibrating the market price alone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LogisticRegression&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;KFold&lt;/span&gt;

&lt;span class="n"&gt;X&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;column_stack&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nf"&gt;logit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p_market&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;logit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p_jev&lt;/span&gt;&lt;span class="p"&gt;)])&lt;/span&gt;
&lt;span class="n"&gt;pred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nc"&gt;KFold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shuffle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;C&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;10.0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;train&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;train&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="n"&gt;pred&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict_proba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;])[:,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;brier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pred&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;coef_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="c1"&gt;# 0.150, [+0.92, +0.20]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Inside a price bucket.&lt;/strong&gt; This is the "mispricing filter" use. Take all markets priced between 35 and 65 cents and ask whether Jev can tell which ones will resolve Yes. Its AUC inside that bucket is 0.536. For longshots under 5 cents it's 0.480. For favourites above 85 cents it's 0.379, worse than reversing it. Once you know the price, Jev's number carries nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Paper trades.&lt;/strong&gt; Buy a Yes share when Jev is higher than the price by more than a threshold, a No share when it's lower. Only markets priced between 10 and 90 cents, no fees or spread.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.4&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;buy_yes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_jev&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p_market&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;
    &lt;span class="n"&gt;buy_no&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_market&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p_jev&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;
    &lt;span class="n"&gt;pnl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;concatenate&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;buy_yes&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p_market&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;buy_yes&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;              &lt;span class="c1"&gt;# Yes share pays 1 or 0
&lt;/span&gt;                          &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;buy_no&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p_market&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;buy_no&lt;/span&gt;&lt;span class="p"&gt;])])&lt;/span&gt;    &lt;span class="c1"&gt;# No share costs 1 - price
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pnl&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;pnl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Jev disagrees with the price by&lt;/th&gt;
&lt;th&gt;Trades&lt;/th&gt;
&lt;th&gt;Mean profit per share (± s.e.)&lt;/th&gt;
&lt;th&gt;Random, same number of trades&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;more than 10 cents&lt;/td&gt;
&lt;td&gt;3,510&lt;/td&gt;
&lt;td&gt;+1.1¢ ± 0.8&lt;/td&gt;
&lt;td&gt;+0.0¢ ± 0.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;more than 20 cents&lt;/td&gt;
&lt;td&gt;1,512&lt;/td&gt;
&lt;td&gt;−1.1¢ ± 1.2&lt;/td&gt;
&lt;td&gt;+0.0¢ ± 1.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;more than 30 cents&lt;/td&gt;
&lt;td&gt;669&lt;/td&gt;
&lt;td&gt;−3.8¢ ± 1.6&lt;/td&gt;
&lt;td&gt;−0.1¢ ± 1.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;more than 40 cents&lt;/td&gt;
&lt;td&gt;299&lt;/td&gt;
&lt;td&gt;−5.0¢ ± 2.1&lt;/td&gt;
&lt;td&gt;−0.2¢ ± 2.8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The more strongly Jev disagrees with the market, the more it loses. That's the market being right about things Jev can't know.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Jev gets most wrong
&lt;/h2&gt;

&lt;p&gt;The largest disagreements tell the story better than the tables:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Market&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Jev&lt;/th&gt;
&lt;th&gt;Resolved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Google Maps renames Lake Ontario to "Lake America" by September 30, 2026?&lt;/td&gt;
&lt;td&gt;0.94&lt;/td&gt;
&lt;td&gt;0.05&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next US-Iran senior diplomatic meeting by September 30, 2026?&lt;/td&gt;
&lt;td&gt;0.05&lt;/td&gt;
&lt;td&gt;0.93&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will Xi Jinping visit US by September 24?&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;0.14&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will Kyler Murray be the Vikings' Week 1 starting QB?&lt;/td&gt;
&lt;td&gt;0.97&lt;/td&gt;
&lt;td&gt;0.10&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will "Patient Zero - Taylor Swift" be the #1 song this week?&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;0.15&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every one of these is a question whose answer was in the news the day before, and not in any text Jev was trained on. Jev's 0.05 on Lake America is a perfectly sensible prior about the world as it was described in its training data. The market had read the news. That's the whole gap: a prediction-market trader's edge is current information, and the question text doesn't contain any.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Jev does fine
&lt;/h2&gt;

&lt;p&gt;Reading. The Choice question asked which of seven categories the market belonged to, and Jev's answer matched a keyword rule on 98.6% of the 8,105 markets the rule could label. Same pattern as my &lt;a href="https://moonthetrain.com/lab/can-jev-predict-bitcoin" rel="noopener noreferrer"&gt;Bitcoin test&lt;/a&gt;: Jev reads the input accurately and answers the question it can answer from the input. Whether an event in the future happens is not that question.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I couldn't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One model version&lt;/strong&gt;, jev-1.13.0, and one way of asking. I tried a single Noul phrasing. A different phrasing moves the numbers a little; it doesn't give Jev the news.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The blind state has no context.&lt;/strong&gt; A real bot would add news, odds from a bookmaker, or the current BTC price. Then you're testing the context, and Jev becomes a reader of it, which is the use I'd actually expect to work. I only tested whether Jev knows anything on its own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Markets under a day old are excluded&lt;/strong&gt;, because they have no 24-hour price. Those are mostly daily crypto and sports markets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paper trades ignore spread&lt;/strong&gt; and assume you could buy at the last traded price. Real fills would be worse, so a negative result stays negative.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volume filter.&lt;/strong&gt; $10k and up. Thin markets may be mispriced more often; they're also harder to trade.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this means for a Jev prediction-market bot
&lt;/h2&gt;

&lt;p&gt;If I were building one, I'd take the pitch at its word and measure it the way it suggests: if the scanner finds 1,000 candidates and Jev keeps 30, those 30 have to resolve better than the 1,000. On question text alone they don't. Jev's output is a near-constant 0.3 plus noise, and acting on the noise loses money in proportion to how loudly it disagrees with the price.&lt;/p&gt;

&lt;p&gt;What might work is the boring version: code finds the candidates and gathers the current information, and Jev reads &lt;em&gt;that&lt;/em&gt;, with questions whose answers are in the text it's given. "Does this article say the meeting was cancelled?" is a Jev question. "Will the meeting happen?" isn't.&lt;/p&gt;

&lt;p&gt;Everything is on GitHub so you can rerun it: &lt;a href="https://github.com/truongxxxx/jev-polymarket-test" rel="noopener noreferrer"&gt;github.com/truongxxxx/jev-polymarket-test&lt;/a&gt;. Five scripts, no notebook: fetch markets, fetch prices, build the dataset, call Jev, score. The Jev part costs about $1.60 for all 26,174 markets, or a few cents for one month.&lt;/p&gt;

&lt;p&gt;Next, &lt;a href="https://moonthetrain.com/lab/jev-does-not-remember-the-past" rel="noopener noreferrer"&gt;part 2&lt;/a&gt;: I expected Jev to remember what happened in 2025. It didn't, and that changes how you can backtest it.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>TradingView PMax Strategy Optimization: 4 Rounds on Gold</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sat, 10 Oct 2026 02:59:11 +0000</pubDate>
      <link>https://dev.to/moonthetrain/tradingview-pmax-strategy-optimization-4-rounds-on-gold-1o6o</link>
      <guid>https://dev.to/moonthetrain/tradingview-pmax-strategy-optimization-4-rounds-on-gold-1o6o</guid>
      <description>&lt;p&gt;&lt;em&gt;This is part 2. Part 1 is here: &lt;a href="https://dev.to/moonthetrain/tradingview-pmax-strategy-best-settings-repaint-backtest-2f4"&gt;TradingView PMax Strategy: Best Settings, Repaint, Backtest&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; This is part 2 of my TradingView PMax strategy optimization, and it's about &lt;strong&gt;gold only&lt;/strong&gt; (XAUUSD, H1). In &lt;a href="https://moonthetrain.com/lab/tradingview-pmax-strategy-backtest" rel="noopener noreferrer"&gt;part 1&lt;/a&gt; the original script made a profit factor of 1.37 on gold H1, but the drawdown was large and most of the money came from a few big trades. So I spent four rounds trying to make it better.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two rounds worked, two didn't.&lt;/strong&gt; Changing the exits made it worse. Position sizing on its own did nothing. Running several versions at once cut the drawdown by 40%, and a market filter roughly doubled the profit per unit of risk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Combined, at the same risk:&lt;/strong&gt; sized to the same maximum drawdown as the original (about 960 USD), the optimized version made &lt;strong&gt;+4,660 USD&lt;/strong&gt; from January 2020 to September 2026, against &lt;strong&gt;+1,635 USD&lt;/strong&gt; for the original. Both figures are after spread, commission and swap.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My verdict: a real improvement on gold, with the work shown below. It's not finished. It still has to pass data it has never seen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where part 1 left off
&lt;/h2&gt;

&lt;p&gt;The original PMax strategy on gold H1, January 2020 to September 2026, Exness Raw Spread ticks, after spread, commission and swap:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Net profit (USD, 0.01 lot in total)&lt;/td&gt;
&lt;td&gt;+1,635&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;961&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yearly profit ÷ max drawdown&lt;/td&gt;
&lt;td&gt;0.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Losing years&lt;/td&gt;
&lt;td&gt;2 (2022: −38, 2023: −211)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worst single day&lt;/td&gt;
&lt;td&gt;−215 (8 April 2026)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Share of profit from the 5 biggest trades&lt;/td&gt;
&lt;td&gt;55%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two things bothered me. A profit factor of 1.37 on 448 trades isn't very sure of itself: the 95% range runs from 0.98 to 1.89. And more than half the profit came from five trades. One bad stretch, like the short in early April 2026, could undo a year.&lt;/p&gt;

&lt;h2&gt;
  
  
  The plan: four rounds
&lt;/h2&gt;

&lt;p&gt;Before touching anything, I wrote down four ways to try to make the strategy earn more for the risk it takes, and the order to try them in. Each round attacks a different weakness from part 1.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Round&lt;/th&gt;
&lt;th&gt;What I changed&lt;/th&gt;
&lt;th&gt;The weakness it targets&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Exits&lt;/strong&gt;: protect a trade once it's open, instead of waiting for the opposite signal&lt;/td&gt;
&lt;td&gt;PMax gives back a lot of open profit before it flips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Position sizing&lt;/strong&gt;: risk a fixed share of the account on each trade&lt;/td&gt;
&lt;td&gt;A fixed lot carries far more risk in 2026, with gold above 4,000, than in 2020&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Diversification&lt;/strong&gt;: run several versions of the strategy side by side&lt;/td&gt;
&lt;td&gt;Half the profit came from five trades&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;A market filter&lt;/strong&gt;: let PMax trade only when conditions suit it&lt;/td&gt;
&lt;td&gt;Losing streaks when the market doesn't suit a trend follower&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The entries stay exactly as in part 1 throughout. Every round is judged the same way, which comes next. Then each round in turn, including the two that didn't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I kept myself honest
&lt;/h2&gt;

&lt;p&gt;Optimizing a strategy is the easiest way to fool yourself, so I set the rules before each round:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The pass mark was written down before running anything.&lt;/strong&gt; Usually: better profit per unit of drawdown than the original in &lt;strong&gt;both&lt;/strong&gt; 2020–2023 and 2024–2026, after swap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every result was checked with the candles cut at four different times&lt;/strong&gt; (on the hour, and 15, 30 and 45 minutes past). In part 2 of my SuperTrend test, a beautiful result collapsed under exactly this check, so now it's standard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Neighbouring settings had to agree.&lt;/strong&gt; If only one exact setting works and its neighbours don't, I treat it as luck.&lt;/li&gt;
&lt;li&gt;In the first round I went further and picked settings using 2020–2023 only, then looked at 2024–2026 once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All four rounds use the same PMax entries from part 1, the same data and the same costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 1: better exits? No.
&lt;/h2&gt;

&lt;p&gt;PMax only exits when the opposite signal fires, so it gives back a lot of open profit. The obvious fix is an exit layer, the usual mix of stops that protect a trade once it's open. I tested 90 combinations, each on all four candle timings.&lt;/p&gt;

&lt;p&gt;The winner on 2020–2023 looked great. Its profit factor went from 1.21 to 1.39, and its drawdown from 378 to 151.&lt;/p&gt;

&lt;p&gt;Then I opened 2024–2026, which it had never seen:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Same exit layer, gold H1&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;th&gt;With exits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2020–2023, profit factor&lt;/td&gt;
&lt;td&gt;1.21&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.39&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2024–2026, profit factor&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.35&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.05&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2024–2026, net profit&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+1,769&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+230&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Whole period after swap&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+1,635&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+741&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tight exits help when gold goes sideways, which it mostly did until 2023. From 2024 gold trended hard, and the same exits cut the long runs that make PMax money. None of the 89 alternatives earned more than the original in 2024–2026 either. Exits on their own were a dead end, so I dropped them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 2: position sizing? Not on its own.
&lt;/h2&gt;

&lt;p&gt;A fixed 0.01 lot means a trade in 2026, with gold above 4,000, carries several times the risk of a trade in 2020. So I sized every trade to risk a fixed percentage of the account.&lt;/p&gt;

&lt;p&gt;With nothing else changed, it was &lt;strong&gt;worse&lt;/strong&gt;. At about 20% maximum drawdown, fixed lots grew the account by 7.9% a year and risk-based sizing by 5.2%. Without a hard limit on each trade's loss, sizing just moves the risk around.&lt;/p&gt;

&lt;p&gt;Paired with a loss-cutting rule it beat fixed lots: 10.2% a year against 7.9% at the same 20% drawdown, with the worst year improving from −7.4% to −2.5%. But I found that rule while looking at round 1's test period, so I don't count it as a result yet. It's on my list for the next stage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 3: run several versions at once? Yes, for risk.
&lt;/h2&gt;

&lt;p&gt;Instead of one set of PMax settings, I ran several versions side by side, each with a smaller share of the same total position size. Different versions flip at different moments, so they don't all get hit by the same bad trade.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;After swap&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;th&gt;Several versions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Net profit&lt;/td&gt;
&lt;td&gt;+1,635&lt;/td&gt;
&lt;td&gt;+1,465&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;961&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;565&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yearly profit ÷ max drawdown&lt;/td&gt;
&lt;td&gt;0.25&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.38&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Share of profit from the 5 biggest trades&lt;/td&gt;
&lt;td&gt;55%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worst single day&lt;/td&gt;
&lt;td&gt;−215&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−125&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Profit stayed about the same and the drawdown fell by 40%. That's the point: at the same risk you can trade bigger. It also fixed my worry from part 1. The result no longer hangs on five trades.&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 4: a market filter? Yes.
&lt;/h2&gt;

&lt;p&gt;The last round adds a filter that decides when PMax is allowed to open a trade at all. I tried four designs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One lost money in 2020–2023 and was dropped.&lt;/li&gt;
&lt;li&gt;One looked spectacular, with profit per unit of risk up 2.7 times. But only its exact default setting worked. Every neighbouring setting I tried was no better than no filter, and some were worse, so I treat it as luck.&lt;/li&gt;
&lt;li&gt;One turned out to be the same as another in practice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One held up.&lt;/strong&gt; I tried six variations of its setting, and every one of them beat the unfiltered strategy at all four candle timings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The survivor, on the original single set of settings, after swap:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;th&gt;With the filter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Net profit&lt;/td&gt;
&lt;td&gt;+1,635&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+1,918&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;961&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;571&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yearly profit ÷ max drawdown, 2020–2023&lt;/td&gt;
&lt;td&gt;0.09&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.35&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yearly profit ÷ max drawdown, 2024–2026&lt;/td&gt;
&lt;td&gt;0.56&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.95&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is the only round that raised profit and cut drawdown at the same time, in both periods.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdc48z49c3wairxalney.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdc48z49c3wairxalney.png" alt="Yearly profit divided by maximum drawdown for the original PMax strategy and after each optimization round, XAUUSD H1, Jan 2020 to Sep 2026, Exness ticks, spread, commission and swap included" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Rounds 3 and 4 together
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;After swap, same total lot size&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;th&gt;Optimized&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Net profit&lt;/td&gt;
&lt;td&gt;+1,635&lt;/td&gt;
&lt;td&gt;+1,805&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;961&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;372&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yearly profit ÷ max drawdown&lt;/td&gt;
&lt;td&gt;0.25&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.72&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor&lt;/td&gt;
&lt;td&gt;1.20&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.36&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor 2020–2023 / 2024–2026&lt;/td&gt;
&lt;td&gt;1.06 / 1.29&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.15 / 1.49&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Losing years&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;1&lt;/strong&gt; (2022: −75)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worst single day&lt;/td&gt;
&lt;td&gt;−215&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−92&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Share of profit from the 5 biggest trades&lt;/td&gt;
&lt;td&gt;55%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;6%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Nearly the same profit with less than 40% of the drawdown. So the fair comparison is at &lt;strong&gt;the same risk&lt;/strong&gt;. Size the optimized version up until its worst drawdown matches the original's 961 USD, and it made &lt;strong&gt;+4,660 USD&lt;/strong&gt; against &lt;strong&gt;+1,635 USD&lt;/strong&gt;, about 2.85 times as much. With fixed lot sizes, profit and drawdown scale together, so this is just the table above multiplied by 2.58.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcu84f8pvw6hu0tl0zike.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcu84f8pvw6hu0tl0zike.png" alt="Closed profit of the original PMax strategy versus the optimized version sized to the same maximum drawdown, XAUUSD H1, Jan 2020 to Sep 2026, Exness ticks, spread, commission and swap included" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Does it win every year?
&lt;/h2&gt;

&lt;p&gt;No, and you should know that before trusting any of this. At the same total lot size, the optimized version made less than the original in 2020, 2022, 2024 and 2025, and about the same in 2021. It made more in 2023, where it turned a −211 year into +74, and in 2026. Its advantage comes from much smaller drawdowns, not from making more money every year.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffdmrqwswfxrivz5tpvx6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffdmrqwswfxrivz5tpvx6.png" alt="Profit by year for the original and optimized PMax strategy at the same total lot size, XAUUSD H1, 2020 to Sep 2026, after swap" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And most of the profit still comes from 2025 and 2026, when gold rallied. The optimized version spreads it better, but it's still a trend follower on a market that trended.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I haven't verified yet
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data it has never seen.&lt;/strong&gt; Every round used gold from 2020 to 2026. The next step is gold before 2020, and other markets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Position sizing combined with everything else.&lt;/strong&gt; The numbers above use fixed lots.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MetaTrader 5 on real ticks.&lt;/strong&gt; All of this is my Python port on Exness tick data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap on your account.&lt;/strong&gt; I used the Raw account's swap on gold longs. On a zero-swap account the numbers would be better.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other symbols and timeframes.&lt;/strong&gt; Everything was tuned on gold H1 only. I wouldn't assume it carries over.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bottom line
&lt;/h2&gt;

&lt;p&gt;Four rounds of upgrades to the TradingView PMax strategy on gold H1. Two failed and two worked. At the same risk as the original, the optimized version made about 2.85 times the profit after costs and swap, with one losing year instead of two. It's a better trend filter than the one I started with. It isn't proven until it survives data it hasn't seen.&lt;/p&gt;

&lt;p&gt;Next: that out-of-sample test. If you want the original numbers first, start with &lt;a href="https://moonthetrain.com/lab/tradingview-pmax-strategy-backtest" rel="noopener noreferrer"&gt;part 1&lt;/a&gt;. For the same kind of work on another script, see &lt;a href="https://moonthetrain.com/lab/supertrend-strategy-optimization-gold" rel="noopener noreferrer"&gt;SuperTrend part 2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm not affiliated with TradingView or with KivancOzbilgic. Past results, including backtests, don't guarantee future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>TradingView PMax Strategy: Best Settings, Repaint, Backtest</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Fri, 09 Oct 2026 13:48:08 +0000</pubDate>
      <link>https://dev.to/moonthetrain/tradingview-pmax-strategy-best-settings-repaint-backtest-2f4</link>
      <guid>https://dev.to/moonthetrain/tradingview-pmax-strategy-best-settings-repaint-backtest-2f4</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; This is a TradingView PMax strategy backtest, with the settings and repaint questions answered along the way. The script is PMax Explorer STRATEGY &amp;amp; SCREENER by KivancOzbilgic, the fourth most-boosted open-source strategy on TradingView. I ported it line for line to Python and ran it on 6.7 years of real Exness ticks, with real spreads and commission.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gold H1 is the one result that holds up.&lt;/strong&gt; Profit factor 1.37 on 448 trades, Jan 2020 to Sep 2026. It survives shifted candle times and all 56 settings I tried. After swap on a Raw account it drops to 1.26.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It still mostly rode the gold rally.&lt;/strong&gt; From 2020 to 2022 it had a small real edge: longs and shorts both made money while gold went nowhere. Since 2024, almost all of the profit has come from the long side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forex is break-even at best.&lt;/strong&gt; NZDUSD lost on every timeframe. EURUSD and GBPUSD hover around a profit factor of 1.0, depending on the years you look at.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My verdict: it's a better trend filter than SuperTrend on most of the markets I tested. It's still not a robot you can switch on and forget.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the PMax strategy on TradingView?
&lt;/h2&gt;

&lt;p&gt;PMax ("Profit Maximizer") is SuperTrend with one change: the ATR bands hang off a moving average instead of off price. The &lt;a href="https://www.tradingview.com/script/nHGK4Qtp/" rel="noopener noreferrer"&gt;PMax Explorer script&lt;/a&gt; is under the Mozilla Public License, its current version dates from June 2021, and it had 17,119 boosts when I checked on 9 October 2026.&lt;/p&gt;

&lt;p&gt;Here are the rules with the default settings. Take a 10-period EMA of the bar midpoint (high plus low, divided by two). Draw a stop line 3 × ATR(10) below it and another 3 × ATR(10) above it. Each line only moves in the trend's favour. The strategy goes long when the EMA crosses above the active line and short when it crosses below.&lt;/p&gt;

&lt;p&gt;It's always in the market. There's no stop loss and no take profit. The opposite signal closes the trade and flips it. Here's the core of the Pine code, © KivancOzbilgic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;longStop = MAvg - Multiplier*atr
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg &amp;gt; longStopPrev ? max(longStop, longStopPrev) : longStop
shortStop = MAvg + Multiplier*atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg &amp;lt; shortStopPrev ? min(shortStop, shortStopPrev) : shortStop
dir := dir == -1 and MAvg &amp;gt; shortStopPrev ? 1 : dir == 1 and MAvg &amp;lt; longStopPrev ? -1 : dir
PMax = dir==1 ? longStop: shortStop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the difference from SuperTrend is small but real. SuperTrend flips when a &lt;strong&gt;candle closes&lt;/strong&gt; through the line. PMax flips when the &lt;strong&gt;moving average&lt;/strong&gt; crosses it. A single spiky candle can't flip PMax, but every flip comes a little later.&lt;/p&gt;

&lt;p&gt;The "Explorer" and "Screener" part of the name is a label that lists which of 20 symbols are trending up or down. It doesn't affect the trades, so I didn't test it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does PMax repaint?
&lt;/h2&gt;

&lt;p&gt;No, not the strategy. Signals use closed bars and fill at the next bar's open. What you see on a historical chart is what you'd have got at the time, before costs. The screener's "Potential Reversal" list can change while a bar is still open, and the author says so on the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the author claim?
&lt;/h2&gt;

&lt;p&gt;The description makes more claims than the SuperTrend page did, so this review is mostly a checklist.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Claim in the description&lt;/th&gt;
&lt;th&gt;What I found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"Backtest and optimization results of PMax are far better" than MOST and SuperTrend&lt;/td&gt;
&lt;td&gt;Better than SuperTrend in 7 of 10 H1/H4 tests, much worse on gold H4. I didn't test MOST&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Reduces the number of false signals in sideways" markets&lt;/td&gt;
&lt;td&gt;It trades about half as often as SuperTrend. On EURUSD, GBPUSD and NZDUSD it still loses money or barely breaks even&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Can be used in any type of markets and instruments"&lt;/td&gt;
&lt;td&gt;Gold H1 works. On NZDUSD, none of 112 settings made money in both 2020–2022 and 2023–2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"It does not repaint"&lt;/td&gt;
&lt;td&gt;True for the strategy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Moving average length and type are "the most important" settings&lt;/td&gt;
&lt;td&gt;Length matters less than you'd think on gold, and no MA type wins across markets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"In sideways VAR would be a good choice"&lt;/td&gt;
&lt;td&gt;Mixed. It helps on two forex H4 tests and hurts on gold H4 and EURUSD H1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How I tested it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Port:&lt;/strong&gt; I rewrote the trading logic in Python, keeping Pine's &lt;code&gt;nz()&lt;/code&gt; and cross rules. Over 6.7 years of gold H4 bars, the 135 signals matched the 135 trend flips exactly, and buys and sells alternated every time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; Exness Raw Spread tick archives for XAUUSD, USDJPY, EURUSD, GBPUSD and NZDUSD. Gold starts on 29 January 2020, where the archive starts. Everything runs to September 2026.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Costs:&lt;/strong&gt; longs fill at the real ask and shorts at the real bid. I added 3.5 USD per lot per side for commission. Swap is in its own section, because it changes the gold numbers a lot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs:&lt;/strong&gt; M15, H1, H4 and D1, each with and without costs. On top of that I shifted the candle times, swept 56 settings, tried all eight MA types and tested the second entry method. That's around 800 backtests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Units:&lt;/strong&gt; fixed size, no compounding. Gold is in USD per 0.01 lot (one ounce). Forex is in pips.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is the TradingView backtest accurate?
&lt;/h2&gt;

&lt;p&gt;It gets the signals right and the money too rosy, for the reasons I went through in the &lt;a href="https://moonthetrain.com/lab/tradingview-supertrend-strategy-backtest" rel="noopener noreferrer"&gt;SuperTrend backtest&lt;/a&gt;: no commission in the script, no spread or swap setting in TradingView. PMax trades half as often, so the gap is smaller.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Test&lt;/th&gt;
&lt;th&gt;Trades&lt;/th&gt;
&lt;th&gt;PF, no costs&lt;/th&gt;
&lt;th&gt;PF, real costs&lt;/th&gt;
&lt;th&gt;Net, no costs → real&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gold M15&lt;/td&gt;
&lt;td&gt;1,761&lt;/td&gt;
&lt;td&gt;1.23&lt;/td&gt;
&lt;td&gt;1.21&lt;/td&gt;
&lt;td&gt;+3,489 → +3,219 USD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gold H1&lt;/td&gt;
&lt;td&gt;448&lt;/td&gt;
&lt;td&gt;1.38&lt;/td&gt;
&lt;td&gt;1.37&lt;/td&gt;
&lt;td&gt;+2,706 → +2,638 USD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;USDJPY M15&lt;/td&gt;
&lt;td&gt;1,912&lt;/td&gt;
&lt;td&gt;1.06&lt;/td&gt;
&lt;td&gt;1.02&lt;/td&gt;
&lt;td&gt;+2,939 → +805 pips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GBPUSD M15&lt;/td&gt;
&lt;td&gt;2,005&lt;/td&gt;
&lt;td&gt;0.99&lt;/td&gt;
&lt;td&gt;0.95&lt;/td&gt;
&lt;td&gt;−330 → −2,093 pips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD M15&lt;/td&gt;
&lt;td&gt;2,057&lt;/td&gt;
&lt;td&gt;0.99&lt;/td&gt;
&lt;td&gt;0.91&lt;/td&gt;
&lt;td&gt;−266 → −2,706 pips&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On forex M15, costs turn a near-zero result into a clear loss. On gold H1 they hardly register.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Gold (XAUUSD Raw Spread), 29 Jan 2020 – Sep 2026, default settings, after spread and commission:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Timeframe&lt;/th&gt;
&lt;th&gt;Trades&lt;/th&gt;
&lt;th&gt;Win rate&lt;/th&gt;
&lt;th&gt;PF before swap&lt;/th&gt;
&lt;th&gt;Net before swap&lt;/th&gt;
&lt;th&gt;PF after swap&lt;/th&gt;
&lt;th&gt;Net after swap&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;M15&lt;/td&gt;
&lt;td&gt;1,761&lt;/td&gt;
&lt;td&gt;36.7%&lt;/td&gt;
&lt;td&gt;1.21&lt;/td&gt;
&lt;td&gt;+3,219&lt;/td&gt;
&lt;td&gt;1.17&lt;/td&gt;
&lt;td&gt;+2,565&lt;/td&gt;
&lt;td&gt;1,243&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H1&lt;/td&gt;
&lt;td&gt;448&lt;/td&gt;
&lt;td&gt;40.8%&lt;/td&gt;
&lt;td&gt;1.37&lt;/td&gt;
&lt;td&gt;+2,638&lt;/td&gt;
&lt;td&gt;1.26&lt;/td&gt;
&lt;td&gt;+1,935&lt;/td&gt;
&lt;td&gt;1,321&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H4&lt;/td&gt;
&lt;td&gt;135&lt;/td&gt;
&lt;td&gt;34.8%&lt;/td&gt;
&lt;td&gt;0.98&lt;/td&gt;
&lt;td&gt;−75&lt;/td&gt;
&lt;td&gt;0.84&lt;/td&gt;
&lt;td&gt;−815&lt;/td&gt;
&lt;td&gt;1,740&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;D1&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;34.8%&lt;/td&gt;
&lt;td&gt;1.68&lt;/td&gt;
&lt;td&gt;+1,089&lt;/td&gt;
&lt;td&gt;1.19&lt;/td&gt;
&lt;td&gt;+331&lt;/td&gt;
&lt;td&gt;1,468&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Buy and hold&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;+2,587&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;1,527&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Net and drawdown in USD per 0.01 lot. Drawdown is on open equity, before swap. Swap: −53.33 USD per lot per night on longs, shorts 0, triple on Wednesdays.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F53tfw7c6e1dfppcpvs59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F53tfw7c6e1dfppcpvs59.png" alt="PMax Explorer strategy equity on XAUUSD H1 before and after swap versus buy and hold gold, Jan 2020 to Sep 2026, Exness Raw Spread ticks, spread and commission included" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forex, Raw Spread, Jan 2020 – Sep 2026, same settings, profit factor / net pips:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;M15&lt;/th&gt;
&lt;th&gt;H1&lt;/th&gt;
&lt;th&gt;H4&lt;/th&gt;
&lt;th&gt;D1&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;USDJPY&lt;/td&gt;
&lt;td&gt;1.02 / +805&lt;/td&gt;
&lt;td&gt;1.04 / +1,034&lt;/td&gt;
&lt;td&gt;1.34 / +3,756&lt;/td&gt;
&lt;td&gt;1.02 / +134&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EURUSD&lt;/td&gt;
&lt;td&gt;0.90 / −3,647&lt;/td&gt;
&lt;td&gt;1.09 / +1,321&lt;/td&gt;
&lt;td&gt;1.06 / +493&lt;/td&gt;
&lt;td&gt;0.94 / −227&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GBPUSD&lt;/td&gt;
&lt;td&gt;0.95 / −2,093&lt;/td&gt;
&lt;td&gt;1.03 / +669&lt;/td&gt;
&lt;td&gt;1.14 / +1,403&lt;/td&gt;
&lt;td&gt;1.48 / +1,564&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD&lt;/td&gt;
&lt;td&gt;0.91 / −2,706&lt;/td&gt;
&lt;td&gt;0.85 / −2,163&lt;/td&gt;
&lt;td&gt;0.83 / −1,386&lt;/td&gt;
&lt;td&gt;0.35 / −2,314&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Swap not included for forex. D1 has only 25 to 31 trades per pair, which is too few to mean much.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Is the gold H1 result real?
&lt;/h2&gt;

&lt;p&gt;Partly. It passed every stress test I threw at it, but most of its money comes from one move.&lt;/p&gt;

&lt;p&gt;What it passed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shifted candles.&lt;/strong&gt; I cut the H1 bars at :15, :30 and :45 past the hour instead of on the hour. The profit factor stayed between 1.24 and 1.37.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It isn't a few lucky trades.&lt;/strong&gt; The five biggest winners made +2,109 USD. The other 443 trades still made +528. On SuperTrend H1, the trades outside the top five lost money.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every setting works.&lt;/strong&gt; All 56 combinations in the grid below made money.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now split it by period:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Gold H1&lt;/th&gt;
&lt;th&gt;Trades&lt;/th&gt;
&lt;th&gt;PF&lt;/th&gt;
&lt;th&gt;Longs&lt;/th&gt;
&lt;th&gt;Shorts&lt;/th&gt;
&lt;th&gt;Gold itself&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2020–2022&lt;/td&gt;
&lt;td&gt;194&lt;/td&gt;
&lt;td&gt;1.37&lt;/td&gt;
&lt;td&gt;+468&lt;/td&gt;
&lt;td&gt;+205&lt;/td&gt;
&lt;td&gt;+235&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2023&lt;/td&gt;
&lt;td&gt;77&lt;/td&gt;
&lt;td&gt;0.95&lt;/td&gt;
&lt;td&gt;+88&lt;/td&gt;
&lt;td&gt;−127&lt;/td&gt;
&lt;td&gt;+239&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2024–Sep 2026&lt;/td&gt;
&lt;td&gt;177&lt;/td&gt;
&lt;td&gt;1.44&lt;/td&gt;
&lt;td&gt;+2,057&lt;/td&gt;
&lt;td&gt;−53&lt;/td&gt;
&lt;td&gt;+2,093&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In 2020–2022, gold went from about 1,589 to 1,824 and PMax made almost three times that, with &lt;strong&gt;both&lt;/strong&gt; sides profitable. That's a small edge that doesn't depend on gold going up. After 2023, the short side stopped working, and the result became a slightly smoother way of holding gold.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the best PMax settings?
&lt;/h2&gt;

&lt;p&gt;There isn't a magic one. On gold H1, all 56 settings I tried made money, so the default (EMA 10, ATR 10 × 3) is as good a choice as any. On NZDUSD, none of them made money in both halves of the test. The market matters far more than the dials.&lt;/p&gt;

&lt;p&gt;One backtest with the default settings can look good or bad by accident. So I ran a grid of settings around the default to see whether the result holds when you move the dials. I wasn't looking for the best combination.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I ran the sweep:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two dials, the ones the author says matter.&lt;/strong&gt; ATR multiplier: 1, 1.5, 2, 2.5, 3, 3.5, 4 and 5. EMA length: 5, 8, 10, 15, 20, 30 and 50. That's 56 combinations. The ATR period stayed at 10 and the MA stayed EMA.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ten markets × timeframes.&lt;/strong&gt; All five symbols, each on H1 and H4. That's 560 backtests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same conditions as the main test.&lt;/strong&gt; Real spread, commission, no swap, signals at bar close, fills at the next open.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two scores per combination.&lt;/strong&gt; The first is the profit factor over the full period. The second, which matters more, is whether the combination made money in &lt;strong&gt;both&lt;/strong&gt; halves: 2020–2022 and 2023–Sep 2026. A setting that only works in one half has probably just caught one big move.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn't pick a winner from the grid. Every headline number in this post uses the defaults: EMA 10, ATR 10 × 3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What came out:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Market&lt;/th&gt;
&lt;th&gt;Combos with PF &amp;gt; 1&lt;/th&gt;
&lt;th&gt;PF &amp;gt; 1.2&lt;/th&gt;
&lt;th&gt;Profitable in both halves&lt;/th&gt;
&lt;th&gt;Median PF&lt;/th&gt;
&lt;th&gt;Default PF&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;XAUUSD H1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;56 / 56&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;44&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;46&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.29&lt;/td&gt;
&lt;td&gt;1.37&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XAUUSD H4&lt;/td&gt;
&lt;td&gt;38&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;1.18&lt;/td&gt;
&lt;td&gt;0.98&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;USDJPY H1&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;34&lt;/td&gt;
&lt;td&gt;1.09&lt;/td&gt;
&lt;td&gt;1.04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;USDJPY H4&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;td&gt;35&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;1.34&lt;/td&gt;
&lt;td&gt;1.34&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EURUSD H1&lt;/td&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;1.01&lt;/td&gt;
&lt;td&gt;1.09&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EURUSD H4&lt;/td&gt;
&lt;td&gt;47&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;1.09&lt;/td&gt;
&lt;td&gt;1.06&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GBPUSD H1&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;0.96&lt;/td&gt;
&lt;td&gt;1.03&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GBPUSD H4&lt;/td&gt;
&lt;td&gt;28&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;1.14&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD H1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD H4&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.91&lt;/td&gt;
&lt;td&gt;0.83&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;56 combinations per row. Trade counts run from about 160 (wide settings) to 1,800 (tight settings) on H1, and from 33 to 490 on H4.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gold H1 is the one result that doesn't depend on the settings.&lt;/strong&gt; All 56 made money, 46 of them in both halves, and the worst had a profit factor of 1.03. The default isn't sitting on a lucky peak. Its 1.37 is close to the middle of the grid.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NZDUSD is the opposite.&lt;/strong&gt; On H1, nothing made money. On H4, some settings made money over the full period, but none in both halves. No setting fixes PMax on this pair.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EURUSD and GBPUSD hover around break-even.&lt;/strong&gt; Medians run from 0.96 to 1.09, and only 7 to 13 combinations held up in both halves. That's noise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;USDJPY H4 has a high median (1.34), but only 26 of 56 combinations held up in both halves.&lt;/strong&gt; The profit is the yen's slide in 2022 and 2024. In 2025 and 2026 the default lost 1,844 pips.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxeac9pl30y3dzq2wkztm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxeac9pl30y3dzq2wkztm.png" alt="Heatmap of PMax profit factor on XAUUSD H1 by ATR multiplier and EMA length, full test Jan 2020 to Sep 2026 versus 2020 to 2022 only, Exness ticks, spread and commission included, swap not included" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I don't quote the best cell.&lt;/strong&gt; Every grid has one. Here's what it looked like in each half:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Market&lt;/th&gt;
&lt;th&gt;Best combination&lt;/th&gt;
&lt;th&gt;PF, full period&lt;/th&gt;
&lt;th&gt;PF, 2020–2022&lt;/th&gt;
&lt;th&gt;PF, 2023–2026&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;XAUUSD H4&lt;/td&gt;
&lt;td&gt;ATR × 4, EMA 50&lt;/td&gt;
&lt;td&gt;3.46&lt;/td&gt;
&lt;td&gt;1.13&lt;/td&gt;
&lt;td&gt;6.32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XAUUSD H1&lt;/td&gt;
&lt;td&gt;ATR × 5, EMA 10&lt;/td&gt;
&lt;td&gt;1.72&lt;/td&gt;
&lt;td&gt;0.98&lt;/td&gt;
&lt;td&gt;2.34&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD H4&lt;/td&gt;
&lt;td&gt;ATR × 5, EMA 10&lt;/td&gt;
&lt;td&gt;1.32&lt;/td&gt;
&lt;td&gt;2.53&lt;/td&gt;
&lt;td&gt;0.79&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On gold, the top cell is the one that rode the 2024–2026 rally hardest. Before the rally it was flat. NZDUSD went the other way: great until 2022, losing after. If you'd optimised on the first half, you'd have picked a setting that failed in the second.&lt;/p&gt;

&lt;p&gt;This sweep isn't an optimisation with a separate out-of-sample test, and it can't tell you which setting will work next year. It only shows whether a market gives PMax a chance across many settings. Gold H1 does. NZDUSD doesn't. The rest is a coin flip after costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the author's advice hold up?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Which moving average is best for PMax?&lt;/strong&gt; None of them across the board. I ran all eight types on H1 and H4 for all five symbols:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;MA type&lt;/th&gt;
&lt;th&gt;Tests with PF &amp;gt; 1 (of 10)&lt;/th&gt;
&lt;th&gt;Gold H1&lt;/th&gt;
&lt;th&gt;Gold H4&lt;/th&gt;
&lt;th&gt;NZDUSD H4&lt;/th&gt;
&lt;th&gt;Gold H1 trades&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EMA (default)&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;1.37&lt;/td&gt;
&lt;td&gt;0.98&lt;/td&gt;
&lt;td&gt;0.83&lt;/td&gt;
&lt;td&gt;448&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WMA&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;1.25&lt;/td&gt;
&lt;td&gt;1.02&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;td&gt;532&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SMA&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;1.32&lt;/td&gt;
&lt;td&gt;1.07&lt;/td&gt;
&lt;td&gt;0.95&lt;/td&gt;
&lt;td&gt;488&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VAR&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;1.28&lt;/td&gt;
&lt;td&gt;0.93&lt;/td&gt;
&lt;td&gt;1.05&lt;/td&gt;
&lt;td&gt;337&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WWMA&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;1.23&lt;/td&gt;
&lt;td&gt;0.97&lt;/td&gt;
&lt;td&gt;1.17&lt;/td&gt;
&lt;td&gt;347&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TMA&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1.25&lt;/td&gt;
&lt;td&gt;0.92&lt;/td&gt;
&lt;td&gt;0.91&lt;/td&gt;
&lt;td&gt;534&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ZLEMA&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1.16&lt;/td&gt;
&lt;td&gt;1.58&lt;/td&gt;
&lt;td&gt;0.84&lt;/td&gt;
&lt;td&gt;897&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TSF&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1.10&lt;/td&gt;
&lt;td&gt;1.35&lt;/td&gt;
&lt;td&gt;0.79&lt;/td&gt;
&lt;td&gt;1,127&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The default EMA is as good as any. VAR, which the author suggests for sideways markets, trades the least. It rescued NZDUSD H4 (0.83 to 1.05) and helped GBPUSD H4 (1.20), but it was worse on gold H4 and EURUSD H1. And look at the gold H4 column. The same strategy goes from 0.92 to 1.58 just by changing the MA type. A result that sensitive is mostly noise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about buying when price crosses PMax?&lt;/strong&gt; The description offers this as a second way to trade it. It roughly triples the number of trades, and the profit factor was lower than the default in 14 of 20 tests. Gold H4 (1.45) and D1 (2.93, only 49 trades) were the exceptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is PMax better than SuperTrend?&lt;/strong&gt; On most of what I tested, yes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcpmjievxyfbdj9tkuckj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcpmjievxyfbdj9tkuckj.png" alt="PMax versus SuperTrend profit factor on H1 and H4 for XAUUSD, USDJPY, EURUSD, GBPUSD and NZDUSD, same Exness tick data and costs, default settings" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PMax had the higher profit factor in 7 of 10 H1/H4 tests, with roughly half the trades. The big exception is gold H4, where SuperTrend made 1.90 and PMax 0.98. So "far better" is too strong. It's usually a bit better and sometimes a lot worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where does it break?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvljqdenjjdoo6uhuj5b9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvljqdenjjdoo6uhuj5b9.png" alt="PMax profit factor after costs by symbol and timeframe, 2020 to 2022 versus 2023 to Sep 2026, default settings, Exness Raw Spread ticks" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mostly on forex after 2022. In 2023–2026 every forex H1 test was below 1.0 (0.93 to 0.96), and on H4 only GBPUSD (1.12) and USDJPY (1.01) stayed above it. Add gold H4, which broke even before swap and lost 815 USD per 0.01 lot after it, and the gold short side since 2023.&lt;/p&gt;

&lt;h2&gt;
  
  
  Risk structure
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No stop loss.&lt;/strong&gt; A trade only ends when the opposite signal fires. The worst gold H1 trade lost 219 USD per 0.01 lot: a short from 4,599 on 2 April 2026, closed at 4,818 six days later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All ten of the worst gold H1 trades happened between October 2025 and August 2026&lt;/strong&gt;, when gold traded between 4,000 and 5,200. A fixed lot risks more as the price and its swings grow. Size by ATR or by percent risk if you run it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long holds and swap.&lt;/strong&gt; Gold H1 trades last 5.4 days on average (longest 30), H4 18 days, D1 104 days. On a Raw account, swap took 703 USD of the 2,638 on gold H1. On an account with zero swap on gold, the before-swap column is the one that applies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drawdown in money.&lt;/strong&gt; On gold H1 the worst drawdown was 1,321 USD per 0.01 lot on open equity. That's 13% of a 10,000 USD account at 0.01 lot, and more than the whole account at 0.1 lot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What isn't a red flag:&lt;/strong&gt; no martingale, no grid, no averaging down. A 34–41% win rate is normal for trend following, and so are losing streaks of 10 (gold H1) and 13 (NZDUSD H1).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Who should use it?
&lt;/h2&gt;

&lt;p&gt;If you trade gold on H1 and want one line that tells you which side of the market to be on, PMax is a reasonable choice, and it held up better than SuperTrend there. I'd use it as a filter for another entry, or as an exit line. I wouldn't run it on its own on forex. And if you do run it on its own on gold, check your account's swap first, because on a Raw account it takes about a quarter of the profit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I couldn't verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MOST.&lt;/strong&gt; The author compares PMax with MOST and SuperTrend. I've only tested SuperTrend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forex swap.&lt;/strong&gt; It isn't in the forex numbers. On USDJPY longs it may even have helped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The screener.&lt;/strong&gt; Its trend function is written differently from the strategy's. I haven't checked whether its 20-symbol list matches what the strategy itself would do.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TradingView itself.&lt;/strong&gt; The "no costs" figures come from my port with the script's default settings, not from TradingView's tester.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slippage and other brokers.&lt;/strong&gt; Orders fill on the first tick of the next bar. I only used Exness data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Daily candles.&lt;/strong&gt; Mine close at UTC midnight. TradingView's forex daily bars usually close at 17:00 New York.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bottom line
&lt;/h2&gt;

&lt;p&gt;On gold H1, the TradingView PMax strategy beat SuperTrend and held up across every setting, with a small real edge in 2020–2022 and mostly rally profit after that. On forex it was break-even at best. It's a good trend filter and a weak robot.&lt;/p&gt;

&lt;p&gt;This is part of a series where I take the most-boosted open-source TradingView strategies, port them exactly and test them on broker ticks with real costs. If you want to see what changing the exits does to a trend strategy like this, &lt;a href="https://moonthetrain.com/lab/supertrend-strategy-optimization-gold" rel="noopener noreferrer"&gt;SuperTrend part 2&lt;/a&gt; keeps the entries and swaps the trade management on gold H4.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm not affiliated with TradingView or with KivancOzbilgic. Past results, including backtests, don't guarantee future results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Should you trade with Jev? My verdict after testing it</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sun, 04 Oct 2026 11:59:24 +0000</pubDate>
      <link>https://dev.to/moonthetrain/should-you-trade-with-jev-my-verdict-after-testing-it-3n9e</link>
      <guid>https://dev.to/moonthetrain/should-you-trade-with-jev-my-verdict-after-testing-it-3n9e</guid>
      <description>&lt;p&gt;&lt;strong&gt;Should you trade with Jev?&lt;/strong&gt; Not on price data, not yet. I haven't found anyone who has shown it beats a simple model at reading a market, and in my own test it read Bitcoin's indicators the wrong way round. Where Jev does look useful is on jobs where the answer is already in the data: classifying, checking, reading a label off a list. Keep it out of the order path until you've backtested it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this series set out to answer
&lt;/h2&gt;

&lt;p&gt;Jev showed up everywhere in September 2026, and trading bots appeared next to the game demos. I wanted to know whether any of it worked on a market, so I followed the trail:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Part&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Short answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://moonthetrain.com/lab/jev-trading-projects" rel="noopener noreferrer"&gt;1&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Is anyone showing results trading with Jev?&lt;/td&gt;
&lt;td&gt;19 projects read; mostly demos; 4 compared Jev with something simpler and Jev didn't win&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-review" rel="noopener noreferrer"&gt;2&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Is QuantDinger, the biggest one, safe for real money?&lt;/td&gt;
&lt;td&gt;solid order handling; account risk limits not wired into live trading&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-exit-layers" rel="noopener noreferrer"&gt;3&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;What's worth copying from its bots?&lt;/td&gt;
&lt;td&gt;three exit layers; not the martingale (20–250 wins to repay one loss)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;4&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;How does it use Jev?&lt;/td&gt;
&lt;td&gt;as an entry veto; sensible rules, but fail-open and impossible to backtest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://moonthetrain.com/lab/can-jev-predict-bitcoin" rel="noopener noreferrer"&gt;5&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Can Jev read a market at all?&lt;/td&gt;
&lt;td&gt;not on 1,500 unseen BTC 5m candles: AUC 0.486 vs 0.522 for a plain model&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why the hype and the evidence don't match
&lt;/h2&gt;

&lt;p&gt;Three reasons, I think.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demos are easy and they look good.&lt;/strong&gt; A bot that asks Jev "buy or sell?" twice a second and draws a live chart takes a weekend. Measuring whether it beats "always predict down" takes longer, and nobody shares a chart of that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A probability looks like knowledge.&lt;/strong&gt; Jev answers &lt;code&gt;0.63&lt;/code&gt; instead of "maybe", which feels precise. But in my test its up-probabilities moved with the indicators in the textbook direction, confidently, and the market went the other way. Precise isn't the same as right.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Almost nobody runs a baseline.&lt;/strong&gt; Of the 12 trading projects in part 1, four compared Jev with anything simpler. That's the step that separates a demo from evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is Jev useless, then?
&lt;/h2&gt;

&lt;p&gt;No. It reads structured data very accurately: my control questions ("is RSI above 50?") came back 99.8% correct. And the projects outside trading tell a better story:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Jev&lt;/th&gt;
&lt;th&gt;Comparison&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Banking customer intents (77 labels)&lt;/td&gt;
&lt;td&gt;92.4%, about $0.00014 a call&lt;/td&gt;
&lt;td&gt;fine-tuned BERT 93.66%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reviewing trade journals for rule breaks (one demo set)&lt;/td&gt;
&lt;td&gt;96.7%, caught 74 of 74 wrong notes&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next-candle direction, BTC 5m (my test)&lt;/td&gt;
&lt;td&gt;AUC 0.486&lt;/td&gt;
&lt;td&gt;plain boosting 0.522&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The pattern: Jev is good when the answer is in the input and it has to find or label it. It's weak when the answer is in the future and depends on how one market actually behaves, which isn't something a model trained on text has been fitted to.&lt;/p&gt;

&lt;p&gt;So if I used it in a trading business, it'd be for the paperwork around trading (tagging trades, checking a journal against the rules, sorting support emails), not for the trades.&lt;/p&gt;

&lt;h2&gt;
  
  
  A checklist for any "AI trading" claim
&lt;/h2&gt;

&lt;p&gt;Whether it's Jev or anything else, I'd want these five answered before trusting it with money:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Compared with what?&lt;/strong&gt; A simple rule or a plain model, on the same data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On data it hadn't seen?&lt;/strong&gt; A separate test period, chosen before looking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After costs?&lt;/strong&gt; Spread, fees, slippage. My test's best signal made under 1 basis point a trade; fees are 15 to 20.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does it read the inputs correctly?&lt;/strong&gt; Control questions with known answers, so you know a bad result isn't a parsing problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What happens when it fails or isn't sure?&lt;/strong&gt; If the answer is "the trade goes through", the AI is decoration.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What I'm taking into my own EAs
&lt;/h2&gt;

&lt;p&gt;I write MT4/MT5 EAs, which QuantDinger doesn't run, so this is about what carries over. Not Jev. What I'm keeping from all this is the unglamorous part from &lt;a href="https://moonthetrain.com/lab/quantdinger-exit-layers" rel="noopener noreferrer"&gt;part 3&lt;/a&gt;, ported to MQL5: a stop on the whole EA's equity, not just per trade, and a trailing stop that only activates once a trade has worked. And a rule for anything I add later: no model goes in front of an order until I've backtested it with and without the model on the same tick data.&lt;/p&gt;

&lt;h2&gt;
  
  
  What would change my mind
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A newer Jev version passing the same test. The code is public: &lt;a href="https://github.com/truongxxxx/jev-btc-test" rel="noopener noreferrer"&gt;github.com/truongxxxx/jev-btc-test&lt;/a&gt;. Rerun it with a new model name and it costs about $0.19.&lt;/li&gt;
&lt;li&gt;Anyone publishing a Jev trading result against a baseline, on unseen data, after costs. I'd happily write that up.&lt;/li&gt;
&lt;li&gt;A task where the information isn't in the price (news, filings, order flow), which I haven't tested.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything here is a snapshot of late September 2026. Jev is moving fast, and the Bitcoin test is cheap to rerun whenever a new version ships.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>trading</category>
      <category>backtesting</category>
    </item>
  </channel>
</rss>
