<?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>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>
    <item>
      <title>Can Jev predict Bitcoin? It read the indicators backwards</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sun, 04 Oct 2026 11:59:01 +0000</pubDate>
      <link>https://dev.to/moonthetrain/can-jev-predict-bitcoin-it-read-the-indicators-backwards-3n8g</link>
      <guid>https://dev.to/moonthetrain/can-jev-predict-bitcoin-it-read-the-indicators-backwards-3n8g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Can Jev predict Bitcoin? On the test I ran, no.&lt;/strong&gt; I sent Jev the same 12 technical indicators that a plain gradient-boosting model used, for 1,500 BTCUSDT 5-minute candles neither had seen. Jev answered the control questions correctly 99.8% of the time, so it read the numbers fine. On the actual question, whether the next candle closes up, it scored an AUC of 0.486 (0.500 is a coin flip). The boosting model scored 0.522. Adding Jev on top of boosting, as a filter or blended in, didn't improve it either.&lt;/p&gt;

&lt;p&gt;The interesting part is why. Jev reads indicators like a textbook, and 5-minute Bitcoin doesn't behave like the textbook.&lt;/p&gt;

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

&lt;p&gt;This is part 5 of the series. In &lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;part 4&lt;/a&gt; I read how QuantDinger lets Jev veto entry orders. The rules were sensible, but they all assume Jev reads the market the right way round, and the gate can't be backtested to check.&lt;/p&gt;

&lt;p&gt;So I tested that assumption on its own, in the narrowest form I could think of. Jev takes a JSON "state" and typed questions and returns probabilities, so I gave it clean indicators and one question about direction, and compared it with a plain statistical model given the same numbers. 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;The task is deliberately narrow: when a BTCUSDT 5-minute candle closes, will the &lt;strong&gt;next&lt;/strong&gt; candle close above its open?&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;Data&lt;/td&gt;
&lt;td&gt;BTCUSDT 5m from Binance's public API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Train&lt;/td&gt;
&lt;td&gt;2022-01-01 → 2024-12-31 (314,552 candles)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation&lt;/td&gt;
&lt;td&gt;2024-07 → 2024-12, used for every choice I made&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test&lt;/td&gt;
&lt;td&gt;2025-01-01 → 2026-09-24 (181,290 candles), scored once&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indicators&lt;/td&gt;
&lt;td&gt;51: EMA 9/21/50/200, RSI, MACD, ATR, Bollinger, candle shape, streaks, 15m and 1h candles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev model&lt;/td&gt;
&lt;td&gt;jev-1.13.0, 1,500 random test candles, two formats&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;4,560 Jev requests, about $0.19&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two things matter more than the table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A baseline.&lt;/strong&gt; "Jev is 53% accurate" means nothing on its own. If a one-line rule also gets 53%, Jev adds nothing but latency and a bill. So everything here is compared with a gradient-boosting model fed the exact same numbers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A fair shot for Jev.&lt;/strong&gt; I didn't throw raw candles at it. The 51 indicators were cut down to the 12 that mattered most on the validation window (I call this set A_top12), and Jev got them both as numbers with definitions and as a plain-English description. The data was blind: no symbol, no dates, no prices, so Jev couldn't recognise a famous day in Bitcoin's history. And every request carried two control questions whose answers sat in the data ("is RSI above 50?"). If Jev failed those, the main result would be about parsing, not prediction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do the indicators predict anything at all?
&lt;/h2&gt;

&lt;p&gt;A little. Across the full test period:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method (181,290 test candles)&lt;/th&gt;
&lt;th&gt;Accuracy&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&lt;/td&gt;
&lt;td&gt;49.9%&lt;/td&gt;
&lt;td&gt;0.500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Momentum: last candle up → up&lt;/td&gt;
&lt;td&gt;49.5%&lt;/td&gt;
&lt;td&gt;0.495&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reversal: last candle up → down&lt;/td&gt;
&lt;td&gt;50.6%&lt;/td&gt;
&lt;td&gt;0.506&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logistic regression, 51 indicators&lt;/td&gt;
&lt;td&gt;51.5%&lt;/td&gt;
&lt;td&gt;0.522 (0.520–0.525)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gradient boosting, 51 indicators&lt;/td&gt;
&lt;td&gt;51.9%&lt;/td&gt;
&lt;td&gt;0.527 (0.524–0.530)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Gradient boosting, A_top12&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;51.7%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.526 (0.524–0.530)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Small, but real. A_top12 held up in every slice: AUC 0.529 in 2025 H1, 0.524 in 2025 H2, 0.527 in 2026. The signal is short-term &lt;strong&gt;reversal&lt;/strong&gt;. When price has just run far above its 9-period EMA, the next 5-minute candle leans slightly down, and the other way round.&lt;/p&gt;

&lt;p&gt;It isn't tradable, though, and I'd rather say that before anyone asks.&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%2Fx3dzl6qqmi744hvztxz7.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%2Fx3dzl6qqmi744hvztxz7.png" alt="Gross profit per trade of the 12-indicator boosting model versus Binance round-trip taker fees, BTCUSDT 5m, 2025-01 to 2026-09" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even the model's most confident 10% of calls earn 0.74 basis points per trade before costs. A Binance spot round trip costs 15 to 20. So this isn't a strategy. It's a measuring stick, and that's all it needs to be.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can Jev predict the next Bitcoin candle?
&lt;/h2&gt;

&lt;p&gt;No better than guessing, on these 1,500 candles.&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%2Fu5mil0gbt3uvwf11u1nf.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%2Fu5mil0gbt3uvwf11u1nf.png" alt="Next-candle AUC on the same 1,500 unseen BTCUSDT 5m candles: boosting 0.522, Jev numeric 0.486, Jev text 0.494" 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;Method (same 1,500 test candles)&lt;/th&gt;
&lt;th&gt;Control questions correct&lt;/th&gt;
&lt;th&gt;Accuracy&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;Gradient boosting, A_top12&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;td&gt;51.6%&lt;/td&gt;
&lt;td&gt;0.522 (0.493–0.550)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev, numbers&lt;/td&gt;
&lt;td&gt;99.8%&lt;/td&gt;
&lt;td&gt;48.1%&lt;/td&gt;
&lt;td&gt;0.486 (0.459–0.516)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jev, plain text&lt;/td&gt;
&lt;td&gt;99.8% / 99.7%&lt;/td&gt;
&lt;td&gt;49.3%&lt;/td&gt;
&lt;td&gt;0.494 (0.463–0.524)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To be straight about the error bars: with 1,500 samples, every one of these intervals overlaps 0.5, boosting's included. On its own this table can't separate them. What settles it is the next section, because Jev isn't just noisy. It points the wrong way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Jev gets it wrong: it reads the indicators backwards
&lt;/h2&gt;

&lt;p&gt;Here's the rank correlation between each indicator and the probability of an up candle, for boosting and for Jev:&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%2F6zvh3d57bd7uz93y0ryo.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%2F6zvh3d57bd7uz93y0ryo.png" alt="Correlation between four indicators and the predicted chance of an up candle: boosting negative, Jev positive, BTCUSDT 5m test candles" 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;Indicator&lt;/th&gt;
&lt;th&gt;Boosting&lt;/th&gt;
&lt;th&gt;Jev, numbers&lt;/th&gt;
&lt;th&gt;Jev, text&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Distance from EMA9&lt;/td&gt;
&lt;td&gt;−0.80&lt;/td&gt;
&lt;td&gt;+0.83&lt;/td&gt;
&lt;td&gt;+0.72&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Move over the last 3 candles&lt;/td&gt;
&lt;td&gt;−0.66&lt;/td&gt;
&lt;td&gt;+0.76&lt;/td&gt;
&lt;td&gt;+0.70&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same-color streak&lt;/td&gt;
&lt;td&gt;−0.53&lt;/td&gt;
&lt;td&gt;+0.65&lt;/td&gt;
&lt;td&gt;+0.87&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RSI(14), 5m&lt;/td&gt;
&lt;td&gt;−0.76&lt;/td&gt;
&lt;td&gt;+0.77&lt;/td&gt;
&lt;td&gt;+0.51&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Boosting learned from three years of data that a stretched move tends to pull back. Jev reads the same numbers the way a trading book would: price above the EMA, high RSI, four green candles in a row, so more upside. Across the 1,500 candles the two models' predictions correlate at −0.71. They're close to opposites.&lt;/p&gt;

&lt;p&gt;And the market sided with boosting:&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%2Fvf6gjtokfyl46ka6ja9b.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%2Fvf6gjtokfyl46ka6ja9b.png" alt="Share of BTCUSDT 5m candles that closed up by distance from EMA9, actual versus Jev's average prediction, 2025-01 to 2026-09" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Far below the EMA, 52.8% of next candles closed up. Far above it, 46.9%. Jev's average prediction runs the other way, from 41.6% to 54.4%.&lt;/p&gt;

&lt;p&gt;I don't find this surprising, honestly. A model trained on text knows what technical analysis &lt;em&gt;says&lt;/em&gt;. It has never been fitted to how one market on one timeframe actually moves. On 5-minute BTC those two things disagree.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does Jev work as a trade filter?
&lt;/h2&gt;

&lt;p&gt;This is how QuantDinger uses it, so I tested it three ways:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Way of adding Jev&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Compared with boosting alone&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Jev replaces boosting&lt;/td&gt;
&lt;td&gt;AUC 0.486 / 0.494&lt;/td&gt;
&lt;td&gt;worse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trade only when Jev agrees (360 / 440 candles)&lt;/td&gt;
&lt;td&gt;49.4% / 51.6% correct&lt;/td&gt;
&lt;td&gt;worse than boosting keeping its own 360 / 440 most confident calls (51.7% / 53.0%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Blend the two probabilities (weights fitted on validation)&lt;/td&gt;
&lt;td&gt;AUC 0.521 / 0.524&lt;/td&gt;
&lt;td&gt;no change; Jev's weight came out −0.09 / +0.16&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The filter result is the one I'd worry about if I ran a Jev gate like &lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;QuantDinger's&lt;/a&gt; on a live strategy. I took the 300 test candles where boosting was most confident (58.0% of them went its way). In the numeric format Jev agreed with 6 of them and objected to 294. A gate built on Jev would have blocked almost every trade the model liked best.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is this the first time Jev failed on price data?
&lt;/h2&gt;

&lt;p&gt;No. Before this I ran four smaller tests on gold (XAUUSD) and NZDUSD:&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;Jev&lt;/th&gt;
&lt;th&gt;Simple baseline&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Next H1 candle up? Raw candles, 500 samples&lt;/td&gt;
&lt;td&gt;AUC 0.49, said ~0.44 for nearly every sample&lt;/td&gt;
&lt;td&gt;nothing to beat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Will the H1 candle in progress close up?&lt;/td&gt;
&lt;td&gt;AUC 0.815&lt;/td&gt;
&lt;td&gt;logistic 0.819&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Big move in the next hour?&lt;/td&gt;
&lt;td&gt;AUC 0.650&lt;/td&gt;
&lt;td&gt;logistic 0.788&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Burst in the next 15 minutes?&lt;/td&gt;
&lt;td&gt;AUC 0.747&lt;/td&gt;
&lt;td&gt;boosting 0.836&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The BTC test was the kindest setup so far: pre-computed indicators, two formats, the indicators already picked for signal. It still came out the same.&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. A later version may behave differently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One market, one timeframe.&lt;/strong&gt; BTCUSDT on Binance, 5-minute candles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price data only.&lt;/strong&gt; Jev may well help where the information isn't in the price: news, filings, order-book context, prediction markets. I didn't test that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sample size.&lt;/strong&gt; 1,500 Jev samples per format. The backwards reading is clear at that size; a gap of a couple of AUC points is not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompting.&lt;/strong&gt; I could have told Jev "short moves tend to reverse here". But then it'd be repeating what boosting found, not adding anything, so I didn't.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this means for a Jev trade gate
&lt;/h2&gt;

&lt;p&gt;A gate like QuantDinger's asks different questions with a richer state, so this doesn't prove it would fail the same way. But it shows how it could: an AI that reads momentum where the market reverts will veto the best entries, and on my data it did. If you put Jev in front of your orders, save the state for every historical signal and backtest the gate first. With Jev's pricing that costs cents, which is a lot cheaper than finding out live.&lt;/p&gt;

&lt;p&gt;Everything is on GitHub so you can rerun it: &lt;a href="https://github.com/truongxxxx/jev-btc-test" rel="noopener noreferrer"&gt;github.com/truongxxxx/jev-btc-test&lt;/a&gt;. The Jev part costs about $0.19.&lt;/p&gt;

&lt;p&gt;Next, the last part: what I'd conclude from the whole series.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>QuantDinger's Jev trade filter: fail-open, never backtested</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Fri, 02 Oct 2026 01:39:10 +0000</pubDate>
      <link>https://dev.to/moonthetrain/quantdingers-jev-trade-filter-fail-open-never-backtested-5fji</link>
      <guid>https://dev.to/moonthetrain/quantdingers-jev-trade-filter-fail-open-never-backtested-5fji</guid>
      <description>&lt;p&gt;&lt;strong&gt;How does QuantDinger use Jev?&lt;/strong&gt; As a gate in front of entry orders. A strategy decides to buy or sell, then Jev answers six questions and the code decides whether the order goes out. It's a safer design than the bots in &lt;a href="https://moonthetrain.com/lab/jev-trading-projects" rel="noopener noreferrer"&gt;part 1&lt;/a&gt; that let Jev decide everything: exits never go through the AI, and the decision rules live in code, not in a prompt. But the gate lets orders through whenever it can't decide, and there's no way to backtest it. That last point is what made me run my own test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the gate sits
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-review" rel="noopener noreferrer"&gt;Part 2&lt;/a&gt; covered QuantDinger as a platform. Jev is an optional feature on top of it, switched on per strategy or for manual "Quick Trade" orders.&lt;/p&gt;

&lt;p&gt;Everything below comes from reading the source at commit &lt;code&gt;96cec2d&lt;/code&gt; (21 Sep 2026), mainly &lt;code&gt;ai_decision_filter.py&lt;/code&gt; and &lt;code&gt;ai_decision_context.py&lt;/code&gt;. I didn't run the platform; it needs Docker, Postgres and Redis, and I only wanted to know how the gate decides.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does the Jev gate decide?
&lt;/h2&gt;

&lt;p&gt;In this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The strategy produces a signal. Plain code checks risk and the order budget first.&lt;/li&gt;
&lt;li&gt;Is it an &lt;strong&gt;entry&lt;/strong&gt;? Exits, stop losses, take profits and emergency closes skip the AI completely.&lt;/li&gt;
&lt;li&gt;Grid, DCA and martingale bots skip it too.&lt;/li&gt;
&lt;li&gt;One credit is charged. Jev gets the state and six questions, with an 8-second timeout.&lt;/li&gt;
&lt;li&gt;If Jev errors, answers in the wrong format, or isn't confident enough, the platform asks an ordinary LLM (OpenRouter, OpenAI and so on) instead.&lt;/li&gt;
&lt;li&gt;If no LLM is available either, &lt;strong&gt;the order goes through&lt;/strong&gt; and the credit is refunded.&lt;/li&gt;
&lt;li&gt;Every decision is written to an audit table.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It only runs on live strategies, not in backtests or paper trading.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it ask Jev?
&lt;/h2&gt;

&lt;p&gt;Six multiple-choice questions, sent together:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Choices&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Is the data good enough to decide?&lt;/td&gt;
&lt;td&gt;sufficient / partial / insufficient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does the signal agree across timeframes?&lt;/td&gt;
&lt;td&gt;aligned / mixed / conflict / insufficient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does the market regime suit this entry?&lt;/td&gt;
&lt;td&gt;favorable / neutral / adverse / insufficient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Size, leverage, drawdown, losing streak&lt;/td&gt;
&lt;td&gt;clear / caution / block / insufficient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fresh price, valid SL/TP?&lt;/td&gt;
&lt;td&gt;clear / caution / block / insufficient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Final decision&lt;/td&gt;
&lt;td&gt;pass / reject&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The order goes out only when the final answer is &lt;code&gt;pass&lt;/code&gt;, neither the risk nor the execution check says &lt;code&gt;block&lt;/code&gt;, and the timeframes don't show &lt;code&gt;conflict&lt;/code&gt; in an &lt;code&gt;adverse&lt;/code&gt; regime at the same time. The state it sends is compact: a summary of up to 120 bars on two or three timeframes (returns, MAs, RSI, MACD, ATR, support and resistance, data age), open positions, and the strategy's recent results.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it gets right
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exits never wait on the AI.&lt;/strong&gt; A broken or slow model can't trap you in a position. This is the single most important choice and they made it correctly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rules in code.&lt;/strong&gt; Jev answers fixed questions. It doesn't write the rule that decides.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict response checks.&lt;/strong&gt; Every choice must be valid, probabilities must cover every option and sum to 1, and the chosen answer must be the most likely one. Anything else counts as a failure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A full audit trail&lt;/strong&gt;: the state sent, all six answers, probabilities, latency, provider, fallback reason, and the credit charged.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tests&lt;/strong&gt; for the main paths, including "exits bypass the AI".&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where is the filter weak?
&lt;/h2&gt;

&lt;p&gt;Four places, in the order I'd fix them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It lets trades through when unsure.&lt;/strong&gt; If Jev's confidence on the key questions is below 0.55 (the default), the platform treats that as an error and asks a different, uncalibrated LLM. If that isn't configured, the trade goes through. So the moments when the AI is least sure are exactly the moments the filter stops filtering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running out of credits switches it off.&lt;/strong&gt; With no credits left, orders pass without any check. A user can believe the filter is on when it isn't doing anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The prompt leans towards "pass".&lt;/strong&gt; It tells the model that missing evidence alone must not reject and to reject only on concrete evidence. Together with the fail-open paths, the gate only blocks when the model is confident something is wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can't backtest it.&lt;/strong&gt; The filter runs only live. There's no way to replay history and see whether it would have helped or hurt, and the README gives no numbers either.&lt;/p&gt;

&lt;p&gt;Two smaller ones. The data-quality answer is collected but never used in the decision. And &lt;code&gt;caution&lt;/code&gt; on risk or execution doesn't reduce position size; it's treated the same as &lt;code&gt;clear&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The question this left me with
&lt;/h2&gt;

&lt;p&gt;Everything above assumes Jev reads the market the right way round. The gate can only help if, when Jev says &lt;code&gt;adverse&lt;/code&gt; or &lt;code&gt;conflict&lt;/code&gt;, the trade really is worse than average. If Jev reads the evidence backwards, the gate blocks good entries and passes bad ones, and because it only runs live, nobody would see that until the P&amp;amp;L did.&lt;/p&gt;

&lt;p&gt;How much damage that would do depends on how often the gate says no, and the prompt leans towards &lt;code&gt;pass&lt;/code&gt;. That's also something you can't measure without a backtest.&lt;/p&gt;

&lt;p&gt;So I stopped reading code and asked the simpler question directly: given clean indicators on data it has never seen, can Jev tell which way a market is about to move? That's the experiment in &lt;a href="https://moonthetrain.com/lab/can-jev-predict-bitcoin" rel="noopener noreferrer"&gt;part 5&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd change
&lt;/h2&gt;

&lt;p&gt;If I put an AI gate in front of an MT5 EA, I'd keep QuantDinger's two best ideas (exits never go through the model, and the rule lives in code) and change three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Low confidence falls back to a fixed rule I chose&lt;/strong&gt;, like "skip the trade" or "half size". Not to a different model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;caution&lt;/code&gt; cuts the lot size.&lt;/strong&gt; Otherwise the answer is wasted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backtest the gate before going live.&lt;/strong&gt; Save the state for every historical signal, ask the model offline, and compare results with and without the filter on the same tick data. It costs cents with Jev's pricing.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;I didn't run QuantDinger. This is a code reading at one commit; later versions may differ.&lt;/li&gt;
&lt;li&gt;I didn't test QuantDinger's own prompt and questions against market data. Part 5 uses my own setup.&lt;/li&gt;
&lt;li&gt;The SaaS version may be configured differently from the open-source defaults.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next in this series: the experiment. I gave Jev 12 indicators on 1,500 Bitcoin candles it had never seen and compared it with a plain model.&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;moonthetrain.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>trading</category>
      <category>python</category>
    </item>
    <item>
      <title>Three exit layers worth copying from QuantDinger's bots</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Wed, 30 Sep 2026 23:33:05 +0000</pubDate>
      <link>https://dev.to/moonthetrain/three-exit-layers-worth-copying-from-quantdingers-bots-app</link>
      <guid>https://dev.to/moonthetrain/three-exit-layers-worth-copying-from-quantdingers-bots-app</guid>
      <description>&lt;p&gt;&lt;strong&gt;What's worth copying from QuantDinger's trading bots?&lt;/strong&gt; Not the entries. The grid, DCA and martingale bots enter on price levels or a schedule, with no signal at all. What's worth copying is how they &lt;strong&gt;exit&lt;/strong&gt;: three independent layers, per trade, per basket and per bot, with the last one treating each bot as a small account with its own profit target and its own stop. That's a structure I'd happily put into an MQL5 EA. The martingale defaults, on the other hand, need somewhere between 20 and 250 winning cycles to pay for one loss.&lt;/p&gt;

&lt;p&gt;This is part 3 of the series. &lt;a href="https://moonthetrain.com/lab/quantdinger-review" rel="noopener noreferrer"&gt;Part 2&lt;/a&gt; covers the platform as a whole. As before, everything comes from reading the source at commit &lt;code&gt;96cec2d&lt;/code&gt;; the martingale numbers are computed with QuantDinger's own preview function.&lt;/p&gt;

&lt;p&gt;One thing to be clear about: QuantDinger has no EAs and doesn't connect to MetaTrader. Its bots are Python, running on crypto exchanges, IBKR and Alpaca. I write MT4/MT5 tools, so I read their bot rules with one question in mind: which of these would carry over to an MQL5 EA? Where I say "EA" below, that's what I mean.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does QuantDinger have a winning strategy?
&lt;/h2&gt;

&lt;p&gt;No, and it doesn't claim to. It's a platform. Its trading logic comes from four places:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source&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;4 built-in bots: grid, DCA, martingale, layered martingale&lt;/td&gt;
&lt;td&gt;price grid or schedule, no signal&lt;/td&gt;
&lt;td&gt;TP or trailing on the average price, basket stop, bot equity stop&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strategies you write in Python&lt;/td&gt;
&lt;td&gt;whatever you code&lt;/td&gt;
&lt;td&gt;a shared SL / TP / trailing / time-limit toolkit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI-generated strategies&lt;/td&gt;
&lt;td&gt;an LLM writes code from your description&lt;/td&gt;
&lt;td&gt;same toolkit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI market analysis&lt;/td&gt;
&lt;td&gt;a hand-weighted indicator score gives BUY/SELL/HOLD&lt;/td&gt;
&lt;td&gt;SL 2×ATR, TP 3×ATR, size from 1% risk&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The only example strategy in the repo is a 20/50 moving-average crossover. So the value here is the risk plumbing, not an edge.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the three exit layers?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Layer 1, the position.&lt;/strong&gt; Every entry can carry &lt;code&gt;stop_loss_pct&lt;/code&gt;, &lt;code&gt;take_profit_pct&lt;/code&gt;, &lt;code&gt;trailing_stop_pct&lt;/code&gt;, &lt;code&gt;trailing_activation_pct&lt;/code&gt; and &lt;code&gt;time_limit_seconds&lt;/code&gt;. When a basket is averaged into, the stop and target follow the new average price.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2, the basket.&lt;/strong&gt; Each bot compares the current price with the basket's average: at &lt;code&gt;take_profit_pct&lt;/code&gt; it closes everything, at &lt;code&gt;hard_stop_pct&lt;/code&gt; it closes everything. With trailing on, the fixed TP is switched off and only the trailing exit applies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3, the bot's equity.&lt;/strong&gt; This is the part I like. Each bot tracks &lt;code&gt;current value / starting capital − 1&lt;/code&gt;, including realised P&amp;amp;L, open P&amp;amp;L and fees:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Default&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Total profit ≥ &lt;code&gt;equity_take_profit_pct&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;+10%&lt;/td&gt;
&lt;td&gt;close all, stop the bot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total loss ≥ &lt;code&gt;equity_stop_loss_pct&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;−6%&lt;/td&gt;
&lt;td&gt;close all, stop the bot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Peak profit reached &lt;code&gt;activation&lt;/code&gt;, then fell by &lt;code&gt;callback&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;+5%, then −3%&lt;/td&gt;
&lt;td&gt;close all, stop the bot&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So every bot is a mission with an end: run until it's up 10%, down 6%, or has given back 3% after being up 5%, then stop and wait for a human. Plenty of EAs have a stop per trade and nothing above it. A per-EA equity stop and an equity trailing stop are cheap to add in MQL5 (track the EA's own deals by magic number) and they cap the one failure a per-trade stop can't: a long run of small, individually "acceptable" losses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which smaller rules are worth stealing?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Trailing that waits to activate.&lt;/strong&gt; The trailing stop only starts once the trade is up by &lt;code&gt;activation&lt;/code&gt;; after that it sits at &lt;code&gt;peak × (1 − callback)&lt;/code&gt; for a long. Before activation there's no trailing at all, so a fresh trade isn't shaken out by noise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Honest gap fills.&lt;/strong&gt; If a bar opens beyond the stop, the backtest fills at the open, not at the stop price. Plenty of backtesters get this wrong in your favour.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A "panic breakdown" filter.&lt;/strong&gt; In the AI analysis score, an oversold RSI normally adds points. But if the market is in a downtrend or MACD is bearish, that bonus is capped. And in a "panic breakdown" (strong downtrend plus bearish MACD plus a 3% drop in 24 hours, or an 8% drop on 1.3× volume) oversold RSI &lt;strong&gt;subtracts&lt;/strong&gt; points and the total is forced to −25 or lower. It's a simple rule against catching a falling knife.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ATR stops clamped by structure, sized by risk.&lt;/strong&gt; Stop = the closer of price − 2×ATR and support × 0.99. Target = the closer of price + 3×ATR and resistance × 1.01. It warns when reward-to-risk after fees drops below 1. Size = 1% of equity at risk divided by the stop distance, capped at 30% of equity for crypto and 50% elsewhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Should you use the grid bot?
&lt;/h2&gt;

&lt;p&gt;Know what it is first. The default grid runs from −2% to +2% around the start price in 8 cells, long only. At start it &lt;strong&gt;buys 60% of the capital at market&lt;/strong&gt; and spreads that over the four cells above price; the other 40% waits as limit buys in the four cells below. Each cell buys at its lower edge and sells at its upper edge, about 0.5% per round trip before fees.&lt;/p&gt;

&lt;p&gt;That's a bet on sideways-to-up, not a neutral grid. If price breaks the lower edge, the default action is &lt;code&gt;pause&lt;/code&gt;: stop opening trades but &lt;strong&gt;keep the inventory&lt;/strong&gt;. Only the −6% bot equity stop limits the loss.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I wouldn't copy the martingale
&lt;/h2&gt;

&lt;p&gt;The default martingale buys level 1 immediately at market, with no signal, then adds as price falls. I ran the default template through QuantDinger's own preview:&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;Price vs first entry&lt;/th&gt;
&lt;th&gt;Capital at this level&lt;/th&gt;
&lt;th&gt;Capital deployed&lt;/th&gt;
&lt;th&gt;Average price vs first entry&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;0%&lt;/td&gt;
&lt;td&gt;8.0%&lt;/td&gt;
&lt;td&gt;8.0%&lt;/td&gt;
&lt;td&gt;0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;−1.20%&lt;/td&gt;
&lt;td&gt;9.9%&lt;/td&gt;
&lt;td&gt;17.9%&lt;/td&gt;
&lt;td&gt;−0.67%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;−2.88%&lt;/td&gt;
&lt;td&gt;15.9%&lt;/td&gt;
&lt;td&gt;33.8%&lt;/td&gt;
&lt;td&gt;−1.72%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;−5.23%&lt;/td&gt;
&lt;td&gt;25.5%&lt;/td&gt;
&lt;td&gt;59.3%&lt;/td&gt;
&lt;td&gt;−3.26%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;−8.52%&lt;/td&gt;
&lt;td&gt;40.7%&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;−5.48%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The exit is a trailing take profit that starts at +0.5% above the average and trails by 0.2%, so a win usually banks about +0.3% on the capital deployed. The basket stop is 12% below the average, but the −6% bot equity stop fires first: with all five levels in and no leverage, that's around −11% from the first entry.&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%2Fgthr1pzpo30ogjy3y4qt.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%2Fgthr1pzpo30ogjy3y4qt.png" alt="QuantDinger martingale default template: a win is +0.024% to +0.30% of the bot's capital, one loss is −6%" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A win with only level 1 filled makes 0.3% × 8% = &lt;strong&gt;0.024%&lt;/strong&gt; of the bot's capital. A win with all five filled makes about &lt;strong&gt;0.30%&lt;/strong&gt;. One loss costs &lt;strong&gt;6%&lt;/strong&gt;. That's 20 to 250 wins to repay a single stop-out. The win rate looks wonderful right up until one steady slide takes weeks of profit. And after a win, the bot waits one bar and opens level 1 again at market.&lt;/p&gt;

&lt;p&gt;The layered version (5 tiers × 3 orders, size reset each tier, about 20% of capital per tier) spreads the risk more evenly and survives a −12.4% slide before it's fully deployed. It exits the same way, so the same asymmetry applies.&lt;/p&gt;

&lt;p&gt;DCA is gentler (5 buys, one every 24 hours, 19% of capital each, long only, no leverage) but it also enters without a signal, and after any exit, a basket stop included, it resets and starts a new cycle straight away. Only the equity layer stops it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd put in my own EA
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Idea&lt;/th&gt;
&lt;th&gt;Take it?&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Three exit layers (trade / basket / EA equity)&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;the equity layer caps damage per EA, not just per trade&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trailing with an activation threshold&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no early shake-outs before the trade has worked&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Equity trailing (+5%, give back 3%, stop)&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;keeps most of an EA's run, not just one trade's&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Panic-breakdown rule on oversold signals&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;one line, avoids knife-catching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ATR stops clamped by S/R, 1% risk sizing, R:R after fees&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;standard, with a fee check most skip&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grid that buys 60% up front&lt;/td&gt;
&lt;td&gt;only knowingly&lt;/td&gt;
&lt;td&gt;it's a long bet, not a neutral grid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Martingale / DCA with no entry signal&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;20 to 250 wins per loss; it works until the market falls in a straight line&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;ul&gt;
&lt;li&gt;I didn't run these bots live or backtest them on tick data. The ladder and the asymmetry come from the default template and QuantDinger's preview function.&lt;/li&gt;
&lt;li&gt;Defaults can change after commit &lt;code&gt;96cec2d&lt;/code&gt;, and users can override every one of them.&lt;/li&gt;
&lt;li&gt;The +0.3% figure for a win is typical, not fixed; it depends on how far price runs past the trailing activation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So far none of this needs AI. The next part looks at the one piece of QuantDinger that is pure Jev: the gate that approves or blocks entries, and the question it left me with.&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://moonthetrain.com/lab/quantdinger-exit-layers" rel="noopener noreferrer"&gt;moonthetrain.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>trading</category>
      <category>python</category>
      <category>opensource</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>QuantDinger review: solid plumbing, gaps around real money</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Wed, 30 Sep 2026 11:22:30 +0000</pubDate>
      <link>https://dev.to/moonthetrain/quantdinger-review-solid-plumbing-gaps-around-real-money-317k</link>
      <guid>https://dev.to/moonthetrain/quantdinger-review-solid-plumbing-gaps-around-real-money-317k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Is QuantDinger worth using?&lt;/strong&gt; As something to learn from, yes. As a self-hosted platform for real money, not yet, in my reading. The order plumbing is careful (idempotent orders, leases, several layers of reconciliation) and the backtester goes out of its way to avoid look-ahead. But the account-level risk limits exist in the code without being called from live trading, there's no global kill switch, and user strategy code runs in the same process that holds the exchange API keys.&lt;/p&gt;

&lt;p&gt;This is part 2 of the series. In &lt;a href="https://moonthetrain.com/lab/jev-trading-projects" rel="noopener noreferrer"&gt;part 1&lt;/a&gt; I read 19 public Jev finance projects; QuantDinger was the biggest and the only full platform, so it gets three posts of its own, starting with the platform as a whole.&lt;/p&gt;

&lt;h2&gt;
  
  
  What QuantDinger is
&lt;/h2&gt;

&lt;p&gt;A self-hosted, multi-user trading platform, open source (backend under Apache-2.0, about 12,000 GitHub stars, version 5.4.1) and also sold as a SaaS by its authors. The pitch: write a strategy in Python, backtest, paper trade, go live, monitor. Plus a lot of AI: strategy code generation, market analysis, an agent gateway over MCP, and the Jev entry filter I look at in &lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;part 4&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The backend is big: 787 Python files, 291 test files with roughly 2,200 test functions, 24 SQL migrations. The frontend lives in a separate repo under a source-available licence, and the brand needs a commercial licence.&lt;/p&gt;

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

&lt;p&gt;I read the architecture docs and the backend code at commit &lt;code&gt;96cec2d&lt;/code&gt; (21 Sep 2026). I checked the heaviest claims below directly in the source. &lt;strong&gt;I didn't run it&lt;/strong&gt;; that needs Docker, Postgres and Redis, and I wasn't going to connect exchange keys to it anyway. So this is a code review, not a live test, and a newer version may have fixed some of this.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it do well?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Area&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;Process layout&lt;/td&gt;
&lt;td&gt;API, trading worker, scheduler and Celery can run as separate roles; orders are claimed with &lt;code&gt;FOR UPDATE ... SKIP LOCKED&lt;/code&gt; and workers hold a lease with a heartbeat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Order idempotency&lt;/td&gt;
&lt;td&gt;a fixed client order id per pending order, saved &lt;strong&gt;before&lt;/strong&gt; sending&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reconciliation&lt;/td&gt;
&lt;td&gt;order status over REST, WebSocket for five exchanges, periodic position sync, recovery of fills that were never acknowledged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Manual positions&lt;/td&gt;
&lt;td&gt;if you hold more than the strategies' allocation, the bot won't close your part&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Look-ahead&lt;/td&gt;
&lt;td&gt;higher-timeframe bars only become visible once closed; the unfinished live bar is dropped; fundamentals carry an &lt;code&gt;available_at&lt;/code&gt; date; there are tests for this&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CI&lt;/td&gt;
&lt;td&gt;ruff, pytest on real Postgres, pip-audit, bandit, Gitleaks, CodeQL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The look-ahead handling is more careful than in many retail backtesters. If you build your own multi-timeframe system, the "higher timeframe only after it closes" rule is the one to copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is the backtest realistic?
&lt;/h2&gt;

&lt;p&gt;Partly. The event order inside each bar is sensible: pending orders fill at the open, then SL/TP are checked against the bar's high and low, then your code runs and its orders fill at the &lt;strong&gt;next&lt;/strong&gt; open. When SL and TP are both hit in one bar, the default assumes the stop hit first.&lt;/p&gt;

&lt;p&gt;But the cost model is thin:&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;Fee&lt;/td&gt;
&lt;td&gt;0.05% fixed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slippage&lt;/td&gt;
&lt;td&gt;0.05% fixed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spread&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Limit orders&lt;/td&gt;
&lt;td&gt;filled as soon as high or low touches the price&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Metrics&lt;/td&gt;
&lt;td&gt;return, max drawdown, Sharpe, win rate, profit factor; no walk-forward, no in/out-of-sample split&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;td&gt;cached in Redis with a TTL, re-downloaded from free sources, so a rerun can give different numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Range limits&lt;/td&gt;
&lt;td&gt;1m bars up to 30 days; H1/D1 up to 3 years&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No spread is a big deal for forex and gold. And "touch equals fill" on limit orders flatters any strategy that trades at round levels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where are the risks with real money?
&lt;/h2&gt;

&lt;p&gt;Ranked by how much they'd worry me:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Strategy code runs next to the exchange keys.&lt;/strong&gt; Strategy scripts run through &lt;code&gt;exec&lt;/code&gt; inside the same process, guarded by a home-made blocklist (regex, AST checks, trimmed builtins) rather than a container or RestrictedPython. A comment in the code records that the sandbox was bypassed once, in August 2026. There's a 10-second timeout on loading the module, but none on &lt;code&gt;initialize&lt;/code&gt; or &lt;code&gt;handle_data&lt;/code&gt;, and resource limits are off by default. That process also has the database connection and the key that decrypts users' exchange API keys. On a multi-user install, escaping the sandbox means reaching other people's keys. An infinite loop in &lt;code&gt;handle_data&lt;/code&gt; is enough to hang the API. (Indicator scripts, by contrast, run in a properly isolated subprocess.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Account-level risk limits aren't connected.&lt;/strong&gt; &lt;code&gt;account_risk.py&lt;/code&gt; has limits for total notional, margin, leverage and per-symbol exposure. I couldn't find it called anywhere except the tests. There's no daily loss limit or drawdown stop for user-written strategies. The "emergency stop" cancels orders placed by the AI agent; it doesn't stop strategies or close positions, and there's no stop-everything button.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. An agent token with write scope can edit live strategies.&lt;/strong&gt; Letting the AI agent trade live needs several gates: the right scope, an explicit risk acknowledgement, a feature flag, allowed markets, per-order and per-day notional caps. But a token with only write scope can create or edit a strategy with &lt;code&gt;execution_mode=live&lt;/code&gt;, swap its exchange keys and change leverage, which skips all of those gates. It can't start a strategy, but it can change one that's already running. Agent tokens don't expire by default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. One key protects every exchange key.&lt;/strong&gt; API keys are encrypted with Fernet using a single key from the environment, with no KDF, no KMS and no rotation. That environment file can be edited from the admin page. A few code paths fall back to user 1 (the admin) when a user id is missing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Stop losses can quietly fail.&lt;/strong&gt; On perpetual swaps, the SL/TP order is placed on the exchange after the entry fills; if placing it fails, that's logged and the position stays open. On spot, IBKR and Alpaca, strategy SL/TP is checked by polling.&lt;/p&gt;

&lt;p&gt;Smaller items: after a restart, orders stuck for 90 seconds are resent with the same client id without first asking the exchange whether they exist. Manual installs default to admin password &lt;code&gt;123456&lt;/code&gt; and database password &lt;code&gt;quantdinger123&lt;/code&gt; (the install script generates random ones). Alertmanager ships seven rules and no receiver, so alerts go nowhere, and there are no trading metrics (fills, reconciliation drift, P&amp;amp;L). Webhook URLs aren't checked against internal IPs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can I use it for forex or MT5?
&lt;/h2&gt;

&lt;p&gt;No. Live trading covers Binance, OKX, Bitget, Bybit, Gate, HTX, Interactive Brokers and Alpaca. There's no forex broker and no MetaTrader connector. Forex exists only as data (Twelve Data, Tiingo, yfinance) for charts and backtests, and those backtests have no spread.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is it for?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Developers building their own platform&lt;/strong&gt;: read it. The process roles, idempotent order flow, reconciliation and look-ahead rules are worth studying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A single user on a private machine, crypto only&lt;/strong&gt;: risks 1 and 3 shrink a lot if nobody else can reach it. Risks 2 and 5 don't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anyone self-hosting for other people's money&lt;/strong&gt;: I wouldn't, until the sandbox, the account-level limits and the key handling are fixed.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;I didn't run the platform or place an order with it.&lt;/li&gt;
&lt;li&gt;The SaaS may be hardened beyond the open-source defaults.&lt;/li&gt;
&lt;li&gt;The August 2026 sandbox bypass is from a code comment; I didn't reproduce it.&lt;/li&gt;
&lt;li&gt;Anything after commit &lt;code&gt;96cec2d&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next in this series: the trade-management ideas in QuantDinger's bots that I'd actually copy into an EA, and the one I wouldn't touch.&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://moonthetrain.com/lab/quantdinger-review" rel="noopener noreferrer"&gt;moonthetrain.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>trading</category>
      <category>security</category>
    </item>
    <item>
      <title>Jev trading bots: I checked 19 projects for real results</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Wed, 30 Sep 2026 11:20:15 +0000</pubDate>
      <link>https://dev.to/moonthetrain/jev-trading-bots-i-checked-19-projects-for-real-results-odb</link>
      <guid>https://dev.to/moonthetrain/jev-trading-bots-i-checked-19-projects-for-real-results-odb</guid>
      <description>&lt;p&gt;&lt;strong&gt;Is anyone making money trading with Jev?&lt;/strong&gt; Not that I could find. I read every public Jev project in finance I could locate, 19 of them, in the week of 24 September 2026. Most are demos or paper trading. Four put Jev up against a simpler alternative, and in none of those did Jev come out ahead. The biggest and most serious one, QuantDinger, became the subject of the rest of this series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I went looking
&lt;/h2&gt;

&lt;p&gt;In mid-September 2026 my X bookmarks filled up with Jev projects. Jev playing Super Mario from emulator RAM. Jev playing Doom. Jev flying a simulated drone from a camera. A browser agent built on it with 19,940 GitHub stars. All of them had been updated within the same ten days.&lt;/p&gt;

&lt;p&gt;Jev is TypeSafe AI's model: you send it a JSON "state" plus a few typed questions, and it answers with probabilities instead of prose, fast and cheaply ($0.042 per million input tokens). That shape, structured data in and a probability out, looks made for trading. And sure enough, trading bots started appearing next to the games.&lt;/p&gt;

&lt;p&gt;I build and test trading tools for a living, so the question was obvious: does any of this work on a market?&lt;/p&gt;

&lt;h2&gt;
  
  
  What did I find?
&lt;/h2&gt;

&lt;p&gt;A public gist that tracks Jev projects listed 18 in finance, counting its comments. I added one from my own bookmarks and read the code of each one. Here's how they split:&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;Count&lt;/th&gt;
&lt;th&gt;What they are&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trading or price prediction&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;bots, paper funds, signal labs, prediction experiments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Finance, not trading&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;classifying bank-customer intents (two) and IRS tax documents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No working Jev code&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;two empty repos, one deleted, one data backend with Jev switched off&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The 12 that touch trading:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;What Jev does&lt;/th&gt;
&lt;th&gt;How it runs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OpenByteInc/QuantDinger (12,065★)&lt;/td&gt;
&lt;td&gt;approves or blocks a strategy's entry orders&lt;/td&gt;
&lt;td&gt;live and paper, self-hosted platform&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jarrodwatts/jev-trader (2,192★)&lt;/td&gt;
&lt;td&gt;decides buy or sell on every block (~300 ms)&lt;/td&gt;
&lt;td&gt;public version is a dry run&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;aowang-ai/jev-trade (127★)&lt;/td&gt;
&lt;td&gt;decides direction, action and leverage every 2 s&lt;/td&gt;
&lt;td&gt;testnet&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;irfndi/prism-liquidity-agent (107★)&lt;/td&gt;
&lt;td&gt;shadow judgements for a liquidity bot; rules decide&lt;/td&gt;
&lt;td&gt;paper&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sosopop/jev_stock (13★)&lt;/td&gt;
&lt;td&gt;predicts up / flat / down for Hong Kong stocks&lt;/td&gt;
&lt;td&gt;research only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;buberlo/jev-trader (6★)&lt;/td&gt;
&lt;td&gt;six judgements feeding a market-making policy&lt;/td&gt;
&lt;td&gt;design stage, synthetic data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;erboland/jev-fund (3★)&lt;/td&gt;
&lt;td&gt;buy / sell / hold for a 10-stock paper fund&lt;/td&gt;
&lt;td&gt;paper&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;zzsong1023/jev-market-reflex (2★)&lt;/td&gt;
&lt;td&gt;buy / sell / hold every 0.5 s on BTC, ETH, SOL&lt;/td&gt;
&lt;td&gt;paper&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UditJain2622004/Jev-Trading (1★)&lt;/td&gt;
&lt;td&gt;filters scalping entries on SOL&lt;/td&gt;
&lt;td&gt;backtest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gamma-Software/jev-signals-lab (1★)&lt;/td&gt;
&lt;td&gt;12 questions per market snapshot&lt;/td&gt;
&lt;td&gt;proof of concept&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IslamBaraka90/jev-…-financial-use-cases&lt;/td&gt;
&lt;td&gt;50 finance demos, some on price&lt;/td&gt;
&lt;td&gt;demo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;maxlibin/moomoo-jev-trader&lt;/td&gt;
&lt;td&gt;comments on or filters a US-stock bot&lt;/td&gt;
&lt;td&gt;live-capable, filter off by default&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Several of these say plainly that they're demos, and that's fair. A demo isn't a claim of profit. But a demo is also not evidence that it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Did any of them show Jev has an edge?
&lt;/h2&gt;

&lt;p&gt;Four compared Jev with something simpler. None came out clearly ahead:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;Comparison&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;UditJain2622004/Jev-Trading&lt;/td&gt;
&lt;td&gt;18 experiments, Jev filtering SOL 1-minute scalps, each with a no-Jev control&lt;/td&gt;
&lt;td&gt;no experiment profitable; Jev-picked trades won at most 45.7%, and a simple rule matched Jev's best&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sosopop/jev_stock&lt;/td&gt;
&lt;td&gt;120 next-day predictions on HK stocks&lt;/td&gt;
&lt;td&gt;Jev 45% correct; always predicting "down" scored 51.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IslamBaraka90 (50 finance demos)&lt;/td&gt;
&lt;td&gt;Jev against a few lines of rules&lt;/td&gt;
&lt;td&gt;the rules matched or beat Jev in 40 of 47 demos; price calls were 42–52%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;irfndi/prism-liquidity-agent&lt;/td&gt;
&lt;td&gt;author reports PF 3.53 with Jev vs 1.74 without&lt;/td&gt;
&lt;td&gt;the data behind it isn't in the repo&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To be clear about what those numbers are: they come from each repo's own logs, or from simple baselines I computed against them. Each is small. But the direction is the same every time, and nobody has published the opposite: Jev beating a plain model on data it hadn't seen, after costs.&lt;/p&gt;

&lt;p&gt;The non-trading ones look better, for what it's worth. On banking-intent classification Jev scored 92.4% against a fine-tuned BERT's 93.66% (with 24 retrieved examples in each prompt), at about $0.00014 a call. Sorting pages into the right form type, reading a label off a known list: that's the kind of job where it does well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why QuantDinger?
&lt;/h2&gt;

&lt;p&gt;Because it's the one that matters most if it's wrong. It has more stars than all the other trading projects combined, it's a full platform rather than a demo, it can trade real money on real exchanges, and its hosted version charges credits for each Jev check. It also uses Jev in the most sensible-sounding way: not letting the model trade, only letting it veto entries.&lt;/p&gt;

&lt;p&gt;So that's where I went next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-review" rel="noopener noreferrer"&gt;Part 2&lt;/a&gt;&lt;/strong&gt; reviews QuantDinger as a platform: what's solid and what's risky with real money.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-exit-layers" rel="noopener noreferrer"&gt;Part 3&lt;/a&gt;&lt;/strong&gt; covers its trading bots, and the exit structure I'd copy into an EA.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://moonthetrain.com/lab/quantdinger-jev-trade-filter" rel="noopener noreferrer"&gt;Part 4&lt;/a&gt;&lt;/strong&gt; opens up the Jev gate itself, and the question it left me with.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://moonthetrain.com/lab/can-jev-predict-bitcoin" rel="noopener noreferrer"&gt;Part 5&lt;/a&gt;&lt;/strong&gt; is the experiment I ran to answer it, on 181,290 Bitcoin candles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://moonthetrain.com/lab/jev-trading-verdict" rel="noopener noreferrer"&gt;Part 6&lt;/a&gt;&lt;/strong&gt; is what I'd conclude.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;I read code and published logs; I didn't run every project.&lt;/li&gt;
&lt;li&gt;The list is a snapshot of one week in September 2026. New projects appear daily.&lt;/li&gt;
&lt;li&gt;Star counts and commits are as of 24–25 September 2026.&lt;/li&gt;
&lt;li&gt;A project with no published comparison may still work. It just hasn't shown it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Originally published at &lt;a href="https://moonthetrain.com/lab/jev-trading-projects" rel="noopener noreferrer"&gt;moonthetrain.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>trading</category>
      <category>opensource</category>
    </item>
    <item>
      <title>SuperTrend Strategy Optimization: No Losing Year on Gold</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sun, 27 Sep 2026 03:53:58 +0000</pubDate>
      <link>https://dev.to/moonthetrain/supertrend-strategy-optimization-no-losing-year-on-gold-b88</link>
      <guid>https://dev.to/moonthetrain/supertrend-strategy-optimization-no-losing-year-on-gold-b88</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update, 21 Sep 2026.&lt;/strong&gt; I put this result through a harder test after publishing, and the first optimized version below didn't survive it. The final, sturdier version and its numbers are in &lt;strong&gt;Extended results&lt;/strong&gt; near the end. Everything else is the original write-up, unchanged.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; This is part 2 of my SuperTrend strategy optimization, and it's for &lt;strong&gt;gold only&lt;/strong&gt; (XAUUSD, H4). I kept the TradingView script's entries exactly as they were and changed what happens after them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gold H4, Jan 2020 to Sep 2026:&lt;/strong&gt; the profit factor in the worst of three periods went from 1.02 to 1.65, and the worst single year went from 0.77 to 1.59. There's no losing year left.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The cost:&lt;/strong&gt; total profit per 0.01 lot fell from 3,997 USD to 1,359 USD, because the big 2024–2026 runs get cut shorter. Drawdown fell from 658 to 173.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;With risk-based sizing&lt;/strong&gt; on a 10,000 USD account, 2% risk per trade grew it to 21,605 USD with a 5.7% maximum drawdown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Still missing:&lt;/strong&gt; swap, and a real-tick run in MT5. I'm not publishing the exact rules yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My verdict: promising enough to take to the next stage, which is a real-tick test in MetaTrader 5. It's not proven yet.&lt;/p&gt;

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

&lt;p&gt;In &lt;a href="https://moonthetrain.com/lab/tradingview-supertrend-strategy-backtest" rel="noopener noreferrer"&gt;part 1&lt;/a&gt; I ported KivancOzbilgic's SuperTrend STRATEGY from TradingView and ran it on 6.7 years of Exness ticks with real spreads and commission. On gold H4 it made a profit factor of 1.97, but almost all of that came from the 2024–2026 rally. From 2020 to 2023 it was roughly break-even. On NZDUSD it lost on M15, H1 and H4.&lt;/p&gt;

&lt;p&gt;The entries weren't the problem on gold. The question was whether better exits could hold on to the good years without giving everything back in the flat ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  What did I change?
&lt;/h2&gt;

&lt;p&gt;Two things, and neither of them is the entry signal.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A trade-management layer.&lt;/strong&gt; It decides how each position is protected once it's open and when it's closed early, instead of sitting in every trade until SuperTrend flips.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk-based position sizing.&lt;/strong&gt; Lot size comes from a fixed percentage of the account rather than a fixed 0.01 lot, so a trade in 2026 carries the same risk as a trade in 2020, even though gold's price nearly tripled in between.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The SuperTrend signals are exactly the ones from part 1: same 267 entries, same timestamps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is a gold-only optimization.&lt;/strong&gt; Every setting was chosen on XAUUSD H4 and nothing else. I didn't tune it for forex pairs, indices or other timeframes, and the next section shows why you shouldn't assume it carries over.&lt;/p&gt;

&lt;p&gt;I'm keeping the exact rules and settings to myself for now. I may turn this into an EA, and I don't want to publish numbers that someone copies into a live account before it has passed a real-tick test. What I can show is how it was tested, which is the part that tells you whether to trust it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results with a fixed 0.01 lot
&lt;/h2&gt;

&lt;p&gt;Gold (XAUUSD Raw Spread), H4, 29 Jan 2020 to 16 Sep 2026, spread and commission included, swap not included:&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 SuperTrend&lt;/th&gt;
&lt;th&gt;With trade management&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trades&lt;/td&gt;
&lt;td&gt;267&lt;/td&gt;
&lt;td&gt;267&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor&lt;/td&gt;
&lt;td&gt;1.97&lt;/td&gt;
&lt;td&gt;1.97&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PF in the worst period&lt;/td&gt;
&lt;td&gt;1.02&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.65&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PF in the worst year&lt;/td&gt;
&lt;td&gt;0.77&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.59&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Losing years&lt;/td&gt;
&lt;td&gt;2 (2021, 2022)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Net profit, USD per 0.01 lot&lt;/td&gt;
&lt;td&gt;+3,997&lt;/td&gt;
&lt;td&gt;+1,359&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown on closed trades&lt;/td&gt;
&lt;td&gt;658&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;173&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Win rate&lt;/td&gt;
&lt;td&gt;43.4%&lt;/td&gt;
&lt;td&gt;52.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average holding time&lt;/td&gt;
&lt;td&gt;9.1 days&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.2 days&lt;/strong&gt;&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%2F9726fpkczyu14394wtt0.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%2F9726fpkczyu14394wtt0.png" alt="Closed profit of the SuperTrend strategy on XAUUSD H4, original versus with trade management, Jan 2020 to Sep 2026, Exness ticks, swap not included" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The overall profit factor didn't move. What moved is where the profit comes from. The original made most of its money in two years. The managed version makes a smaller amount every year, which is a much easier thing to live with.&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%2F0j8bpv1gsb53ypm5pa5e.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%2F0j8bpv1gsb53ypm5pa5e.png" alt="Profit factor by year of the SuperTrend strategy on XAUUSD H4, original versus with trade management, 2020 to 2026" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Did I just curve-fit it?
&lt;/h2&gt;

&lt;p&gt;That's the first thing I'd ask, so here's what I checked.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Neighbouring settings.&lt;/strong&gt; A result that only works at one exact setting is noise. I ran 35 nearby combinations with the full management in place. The worst-period profit factor stayed above 1.0 in all 35 (lowest 1.06, highest 1.90), and above 1.3 in half of them. The chosen one isn't the highest, and it isn't alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Walk-forward.&lt;/strong&gt; I picked the settings using only 2020–2023, then looked at 2024 to Sep 2026, which the choice never saw. The same settings came out on top, and the unseen period made a profit factor of 2.01.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Random entries.&lt;/strong&gt; I replaced the SuperTrend signals with random entries at the same frequency and kept the same management, 20 times. The median profit factor was 0.96, and the best worst-period result was 1.16. So the management alone isn't the edge. It works on top of SuperTrend's entries, not instead of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every piece earns its place.&lt;/strong&gt; Switching off any single part of the management lowered the worst-period profit factor, to somewhere between 1.05 and 1.56.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A second data set.&lt;/strong&gt; On the Exness Cent gold feed (XAUUSDc) the worst-period profit factor was 1.62, against 1.65 on Raw.&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%2Fffyjikngl3mvbkglr6wt.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%2Fffyjikngl3mvbkglr6wt.png" alt="Worst-period profit factor of SuperTrend with trade management compared with 20 runs of random entries using the same management, XAUUSD H4" width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What does risk-based sizing add?
&lt;/h2&gt;

&lt;p&gt;Same trades, 10,000 USD starting balance, compounding, Jan 2020 to Sep 2026, before swap. The drawdown column includes the worst open loss inside each trade, which is closer to what MT5 reports as equity drawdown.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Risk per trade&lt;/th&gt;
&lt;th&gt;Final balance&lt;/th&gt;
&lt;th&gt;Per year&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;th&gt;Worst year&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;13,979 USD&lt;/td&gt;
&lt;td&gt;5.2%&lt;/td&gt;
&lt;td&gt;2.5%&lt;/td&gt;
&lt;td&gt;+2.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2%&lt;/td&gt;
&lt;td&gt;21,605 USD&lt;/td&gt;
&lt;td&gt;12.4%&lt;/td&gt;
&lt;td&gt;5.7%&lt;/td&gt;
&lt;td&gt;+6.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3%&lt;/td&gt;
&lt;td&gt;31,146 USD&lt;/td&gt;
&lt;td&gt;18.8%&lt;/td&gt;
&lt;td&gt;8.4%&lt;/td&gt;
&lt;td&gt;+8.8%&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%2Fdgrmw2apu0oslhy2bubj.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%2Fdgrmw2apu0oslhy2bubj.png" alt="Account equity of the optimized SuperTrend strategy on XAUUSD H4 at 1%, 2% and 3% risk per trade, 10,000 USD start, 2020 to 2026" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At 3% the yearly results were +23% (2020), +25% (2021), +9% (2022), +20% (2023), +14% (2024), +22% (2025) and +12% (2026 to mid-September). Those are backtest numbers on one instrument, before swap. I'd treat them as an upper bound, not a forecast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where does it still fail?
&lt;/h2&gt;

&lt;p&gt;I optimized for gold H4 only. For context, here's what happened when I ran the same layer elsewhere, without re-tuning it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It gives up the big runs.&lt;/strong&gt; In 2026 the original made 2,432 USD per 0.01 lot on gold H4. The managed version made 216. If you believe gold will trend like that again, the original catches more of it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gold H1 didn't improve.&lt;/strong&gt; On gold H1 the same kind of management made things worse. The result holds on H4 only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NZDUSD is still a loser.&lt;/strong&gt; On H4 the profit factor went from 0.80 to 0.96, still a loss, and on H1 it got worse (0.86 to 0.77). Management can't create a trend where there isn't one.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Swap.&lt;/strong&gt; Still not included. Trades now last 1.2 days on average instead of 9.1, so the strategy spends about 86% fewer nights in the market. The effect will be much smaller than in part 1, but it won't be zero.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real ticks in MT5.&lt;/strong&gt; These results come from checking every minute of Exness archive data. The management reacts to price inside the bar, so it's more sensitive to tick detail than the original strategy was. Within each minute I assumed the worse outcome happens first. A real-tick run in MetaTrader 5 is the next step, and I'll update this post with it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One instrument, by design.&lt;/strong&gt; This optimization is for gold H4 only, over one 6.7-year stretch that included a strong bull market. Don't read it as a result for any other market.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Extended results: does it survive a harder test?
&lt;/h2&gt;

&lt;p&gt;Short answer: the first version didn't. The final one does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The test.&lt;/strong&gt; I kept everything the same and only moved the hour at which the H4 candles open: 00:00, 01:00, 02:00 and 03:00 UTC. A real edge shouldn't care about that. It isn't an academic check either, because your broker's server time decides where your H4 candles start, and brokers don't agree on it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;H4 candles open at&lt;/th&gt;
&lt;th&gt;00:00&lt;/th&gt;
&lt;th&gt;01:00&lt;/th&gt;
&lt;th&gt;02:00&lt;/th&gt;
&lt;th&gt;03:00&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;First optimized version, PF&lt;/td&gt;
&lt;td&gt;1.87&lt;/td&gt;
&lt;td&gt;1.14&lt;/td&gt;
&lt;td&gt;1.36&lt;/td&gt;
&lt;td&gt;1.16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First optimized version, PF in the worst period&lt;/td&gt;
&lt;td&gt;1.59&lt;/td&gt;
&lt;td&gt;0.74&lt;/td&gt;
&lt;td&gt;0.79&lt;/td&gt;
&lt;td&gt;0.96&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Final version, PF&lt;/td&gt;
&lt;td&gt;1.46&lt;/td&gt;
&lt;td&gt;1.45&lt;/td&gt;
&lt;td&gt;1.38&lt;/td&gt;
&lt;td&gt;1.33&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Final version, PF in the worst period&lt;/td&gt;
&lt;td&gt;1.38&lt;/td&gt;
&lt;td&gt;1.32&lt;/td&gt;
&lt;td&gt;1.37&lt;/td&gt;
&lt;td&gt;1.22&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first version only looked good at 00:00. Shift the candles by an hour and it fell below break-even in its worst period. The walk-forward and random-entry checks above didn't catch it, because they all used the same candle timing. That's a lesson I'm keeping: every result on this blog now has to pass this test 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%2Fjh8zniawyycni6jw3pfk.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%2Fjh8zniawyycni6jw3pfk.png" alt="Worst-period profit factor at four different H4 candle opening hours, first optimized version versus final version, XAUUSD 2020 to 2026" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changed.&lt;/strong&gt; I re-ran the optimization and scored every setting by its &lt;em&gt;worst&lt;/em&gt; result across the four candle timings, not its best. The SuperTrend signals are still the originals. What changed is how trades are managed and how risk is spread, and some parts of the first version didn't make the cut. As before, I'm not publishing the rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The final version against the unmodified SuperTrend&lt;/strong&gt;, both run the same way, XAUUSD Raw, Jan 2020 to Sep 2026, spread and commission included, swap not included:&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;Unmodified SuperTrend&lt;/th&gt;
&lt;th&gt;Final version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Profit factor&lt;/td&gt;
&lt;td&gt;1.47&lt;/td&gt;
&lt;td&gt;1.40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PF in the worst period&lt;/td&gt;
&lt;td&gt;1.15&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.33&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yearly return per unit of drawdown&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.86&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same, 2020–2023 only&lt;/td&gt;
&lt;td&gt;0.21&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.97&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worst year&lt;/td&gt;
&lt;td&gt;−3.6%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+2.1%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The overall profit factor is actually a little lower. What improved is everything that decides whether you can live with it: the weak years are much stronger and there's no losing year.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Same drawdown, different result.&lt;/strong&gt; Here both start with 50,000 USD, compounding, each sized so the worst drawdown on closed trades lands at about 20%.&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%2F9npyk6nxy7a5gsloc144.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%2F9npyk6nxy7a5gsloc144.png" alt="Account equity from 50,000 USD, unmodified SuperTrend versus final optimized version, both sized to about the same drawdown, XAUUSD H4 2020 to 2026" width="800" height="432"&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;Unmodified SuperTrend&lt;/th&gt;
&lt;th&gt;Final version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Final balance&lt;/td&gt;
&lt;td&gt;96,974 USD&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;167,627 USD&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per year&lt;/td&gt;
&lt;td&gt;10.6%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;20.1%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown, closed trades&lt;/td&gt;
&lt;td&gt;20.3%&lt;/td&gt;
&lt;td&gt;21.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worst year&lt;/td&gt;
&lt;td&gt;−6.6%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+5.8%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And the final version at three risk levels, 50,000 USD start:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Risk level&lt;/th&gt;
&lt;th&gt;Final balance&lt;/th&gt;
&lt;th&gt;Per year&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;th&gt;Worst year&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;88,390 USD&lt;/td&gt;
&lt;td&gt;9.0%&lt;/td&gt;
&lt;td&gt;10.3%&lt;/td&gt;
&lt;td&gt;+3.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;167,627 USD&lt;/td&gt;
&lt;td&gt;20.1%&lt;/td&gt;
&lt;td&gt;21.7%&lt;/td&gt;
&lt;td&gt;+5.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;286,248 USD&lt;/td&gt;
&lt;td&gt;30.2%&lt;/td&gt;
&lt;td&gt;31.7%&lt;/td&gt;
&lt;td&gt;+7.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Read these with the same caveats as before, plus two new ones.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Swap still isn't included, and there's still no real-tick MT5 run.&lt;/li&gt;
&lt;li&gt;The drawdown here is measured on closed trades. Equity drawdown, the number MT5 shows, will be higher.&lt;/li&gt;
&lt;li&gt;The final version needs a bigger account. Below roughly 50,000 USD the minimum lot size stops it from sizing trades properly, and it starts skipping them.&lt;/li&gt;
&lt;li&gt;6.6 years of data include one sideways stretch and one strong rally, but no long gold bear market.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Before swap and before a real-tick check, adding trade management and risk-based sizing to the TradingView SuperTrend strategy turned gold H4 from "four flat years, then a rally" into seven profitable years out of seven, at a third of the original profit per lot. That's promising, and not yet proven. The first version turned out to depend on the hour the candles open; the final version in the extended results doesn't, and it's the one I'm taking to the MT5 real-tick test.&lt;/p&gt;

&lt;p&gt;If you're reading this before the MT5 update, go back to &lt;a href="https://moonthetrain.com/lab/tradingview-supertrend-strategy-backtest" rel="noopener noreferrer"&gt;part 1&lt;/a&gt; for the unmodified strategy and all its tables.&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;

&lt;p&gt;Originally published at &lt;a href="https://moonthetrain.com/lab/supertrend-strategy-optimization-gold" rel="noopener noreferrer"&gt;moonthetrain.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>trading</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>TradingView SuperTrend Strategy Backtest: 6 Years of Ticks</title>
      <dc:creator>Truong Pham | Moon The Train</dc:creator>
      <pubDate>Sat, 26 Sep 2026 02:29:51 +0000</pubDate>
      <link>https://dev.to/moonthetrain/tradingview-supertrend-strategy-backtest-6-years-of-ticks-1ela</link>
      <guid>https://dev.to/moonthetrain/tradingview-supertrend-strategy-backtest-6-years-of-ticks-1ela</guid>
      <description>&lt;p&gt;&lt;strong&gt;The short version.&lt;/strong&gt; This is a TradingView SuperTrend strategy backtest: the SuperTrend STRATEGY script by KivancOzbilgic, one of the most-boosted open-source strategies on TradingView (25,185 boosts), ported line for line to Python and run 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 H4:&lt;/strong&gt; profit factor 1.97 on 267 trades, Jan 2020 to Sep 2026. But 97% of that profit came from the 2024–2026 gold rally. From 2020 to 2023 it made a profit factor of 1.05.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NZDUSD:&lt;/strong&gt; M15, H1 and H4 all lost, with profit factors between 0.80 and 0.86. I tried 32 parameter combinations on H1 and H4 and none of them got above 1.0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap isn't included.&lt;/strong&gt; The strategy is always in a trade, so every figure here is the best case, not the final number.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My verdict: it's a clean, honest trend filter. It isn't a trading system you can switch on and leave.&lt;/p&gt;

&lt;p&gt;This is the first post in a series. I'm taking the most-boosted open-source strategies on TradingView, porting them exactly, and running them on broker tick data with real costs.&lt;/p&gt;

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

&lt;p&gt;For this kind of strategy, it's accurate about the signals and optimistic about the money. TradingView is a great place to find and read strategies, and the Strategy Tester is a fine tool for checking an idea. But the number it prints isn't the number your broker account would print. None of this is hidden, it's all in TradingView's own docs, and you can fix some of it yourself. Most people don't, though, and this script doesn't.&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;TradingView Strategy Tester&lt;/th&gt;
&lt;th&gt;A real broker account&lt;/th&gt;
&lt;th&gt;This test&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Spread&lt;/td&gt;
&lt;td&gt;Fills on the chart's single price series. There's no spread setting&lt;/td&gt;
&lt;td&gt;You buy at the ask and sell at the bid, and the spread widens around news and the daily rollover&lt;/td&gt;
&lt;td&gt;Real bid and ask on every tick. Median spread 0.063 USD on gold, 0.5 pip on NZDUSD, with NZDUSD daily opens hitting 7.4 pips at the 95th percentile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Commission&lt;/td&gt;
&lt;td&gt;0 unless you set it. This script doesn't&lt;/td&gt;
&lt;td&gt;About 3.5 USD per lot per side on a Raw account&lt;/td&gt;
&lt;td&gt;Included&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slippage&lt;/td&gt;
&lt;td&gt;0 unless you set it&lt;/td&gt;
&lt;td&gt;Real&lt;/td&gt;
&lt;td&gt;Not modelled separately. Orders fill on the first tick of the next bar&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Swap&lt;/td&gt;
&lt;td&gt;No setting for it&lt;/td&gt;
&lt;td&gt;Charged or paid every night, triple on Wednesdays&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Not included either&lt;/strong&gt; (see the risk section)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Price data&lt;/td&gt;
&lt;td&gt;Whatever vendor's symbol you load, not your broker's. Forex daily bars usually close at 17:00 New York&lt;/td&gt;
&lt;td&gt;Your broker's candles and server time&lt;/td&gt;
&lt;td&gt;Exness ticks, daily bars cut at UTC midnight&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fills inside a bar&lt;/td&gt;
&lt;td&gt;Assumes a price path through open, high, low and close. Bar Magnifier uses lower-timeframe data, but needs a Premium or Ultimate plan&lt;/td&gt;
&lt;td&gt;Tick by tick&lt;/td&gt;
&lt;td&gt;Doesn't matter much here, because this script has no stop loss or take profit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;History&lt;/td&gt;
&lt;td&gt;Depends on your plan&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Jan 2020 to Sep 2026, split into three periods&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here's what the cost gap looks like in practice. "No costs" is my port with the same zero-cost defaults the script uses on TradingView. I didn't run it on TradingView itself.&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, Raw account&lt;/td&gt;
&lt;td&gt;4,007&lt;/td&gt;
&lt;td&gt;1.06&lt;/td&gt;
&lt;td&gt;1.03&lt;/td&gt;
&lt;td&gt;+1,447 → +808 USD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gold M15, Cent account&lt;/td&gt;
&lt;td&gt;4,047&lt;/td&gt;
&lt;td&gt;1.04&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;+1,072 → +48 USD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD M15&lt;/td&gt;
&lt;td&gt;4,653&lt;/td&gt;
&lt;td&gt;0.92&lt;/td&gt;
&lt;td&gt;0.80&lt;/td&gt;
&lt;td&gt;−3,534 → −9,298 pips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NZDUSD H1&lt;/td&gt;
&lt;td&gt;1,115&lt;/td&gt;
&lt;td&gt;0.92&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;td&gt;−1,594 → −3,003 pips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gold H4, Raw account&lt;/td&gt;
&lt;td&gt;267&lt;/td&gt;
&lt;td&gt;1.98&lt;/td&gt;
&lt;td&gt;1.97&lt;/td&gt;
&lt;td&gt;+4,038 → +3,997 USD&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So the pattern is simple. The more often a strategy trades, the wider the gap between the TradingView screen and your account. On gold M15 with a Cent account, costs took 96% of the profit. On gold H4, with only 267 trades in six years, they barely register. That's the reason this post exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the SuperTrend STRATEGY?
&lt;/h2&gt;

&lt;p&gt;It's the &lt;a href="https://www.tradingview.com/script/P5Gu6F8k/" rel="noopener noreferrer"&gt;SuperTrend STRATEGY&lt;/a&gt; by KivancOzbilgic, published in September 2020 under the Mozilla Public License, with 25,185 boosts and 657,438 views when I checked on 21 September 2026. It turns the classic SuperTrend indicator into something you can backtest.&lt;/p&gt;

&lt;p&gt;The rules fit in one breath. Take the bar's midpoint (high plus low, divided by two), then draw a line 3 × ATR(10) below it and another 3 × ATR(10) above it. The lower line can only move up while the trend is up, and the upper line can only move down while the trend is down. When a candle closes above the upper line, the strategy goes long. When one closes below the lower line, it goes short.&lt;/p&gt;

&lt;p&gt;It's always in the market. A new signal closes the current trade and opens the opposite one, and there's no stop loss, no take profit and no separate trailing stop. 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;atr = changeATR ? atr(Periods) : atr2
up = src - (Multiplier * atr)
up1 = nz(up[1], up)
up := close[1] &amp;gt; up1 ? max(up, up1) : up
dn = src + (Multiplier * atr)
dn1 = nz(dn[1], dn)
dn := close[1] &amp;lt; dn1 ? min(dn, dn1) : dn
trend := trend == -1 and close &amp;gt; dn1 ? 1 : trend == 1 and close &amp;lt; up1 ? -1 : trend
buySignal = trend == 1 and trend[1] == -1
sellSignal = trend == -1 and trend[1] == 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Does the SuperTrend strategy repaint?
&lt;/h2&gt;

&lt;p&gt;No. Signals are calculated on closed bars, and the order fills at the open of the next bar. Nothing in the script looks at a higher timeframe or at future data. What you see on a historical chart is what you'd have got at the time, before costs.&lt;/p&gt;

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

&lt;p&gt;Not much, which is to the author's credit. There's no profit figure anywhere on the page.&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 checked&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Works on equities, futures, forex and crypto, on daily, weekly and hourly charts&lt;/td&gt;
&lt;td&gt;Gold and NZDUSD, on M15, H1, H4 and D1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Gives an accurate reading about an ongoing trend"&lt;/td&gt;
&lt;td&gt;Whether the trend reading makes money after costs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Generally, it fails in a sideways-moving market"&lt;/td&gt;
&lt;td&gt;Performance in 2022–2023, when gold went sideways&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Default settings: ATR period 10, multiplier 3&lt;/td&gt;
&lt;td&gt;Default, plus a 4 × 4 grid around it&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 Pine script in Python and checked it against a separate line-by-line translation of the Pine logic. Trend and signals matched on every bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; tick archives from Exness. XAUUSD Raw Spread from 29 January 2020 (that's where the archive starts), XAUUSDc (Cent account) from 1 January 2020, and NZDUSD Raw Spread, all to 16 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. On Raw accounts I added 3.5 USD per lot per side for commission. &lt;strong&gt;I didn't include swap.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs:&lt;/strong&gt; four timeframes, each with and without costs, on three data sets. Results were split into three periods (2020–21, 2022–23, 2024–26), plus a parameter grid on H1, H4 and D1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Units:&lt;/strong&gt; fixed size, no compounding. Gold results are in USD per ounce, which is the same as USD per 0.01 lot. NZDUSD results are in pips.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Gold (XAUUSD Raw Spread), 29 Jan 2020 – 16 Sep 2026, default settings, after spread and commission, before swap:&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;Profit factor&lt;/th&gt;
&lt;th&gt;Net (USD per 0.01 lot)&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;4,007&lt;/td&gt;
&lt;td&gt;34.0%&lt;/td&gt;
&lt;td&gt;1.03&lt;/td&gt;
&lt;td&gt;+808&lt;/td&gt;
&lt;td&gt;1,516&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H1&lt;/td&gt;
&lt;td&gt;927&lt;/td&gt;
&lt;td&gt;37.1%&lt;/td&gt;
&lt;td&gt;1.11&lt;/td&gt;
&lt;td&gt;+1,290&lt;/td&gt;
&lt;td&gt;924&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H4&lt;/td&gt;
&lt;td&gt;267&lt;/td&gt;
&lt;td&gt;43.4%&lt;/td&gt;
&lt;td&gt;1.97&lt;/td&gt;
&lt;td&gt;+3,997&lt;/td&gt;
&lt;td&gt;782&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;D1&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;td&gt;33.3%&lt;/td&gt;
&lt;td&gt;0.93&lt;/td&gt;
&lt;td&gt;−243&lt;/td&gt;
&lt;td&gt;1,552&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,703&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;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%2Fecqor40eblnytjpcd12u.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%2Fecqor40eblnytjpcd12u.png" alt="TradingView SuperTrend strategy equity curve on XAUUSD H4 versus buy and hold gold, Jan 2020 to Sep 2026, Exness ticks, spread and commission included, swap not included" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Cent account gave the same picture. Every timeframe landed within 0.05 of the Raw profit factor, so the type of account isn't what drives these results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NZDUSD Raw Spread, Jan 2020 – 16 Sep 2026, same settings:&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;Profit factor&lt;/th&gt;
&lt;th&gt;Net (pips)&lt;/th&gt;
&lt;th&gt;Max drawdown (pips)&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;4,653&lt;/td&gt;
&lt;td&gt;33.1%&lt;/td&gt;
&lt;td&gt;0.80&lt;/td&gt;
&lt;td&gt;−9,298&lt;/td&gt;
&lt;td&gt;9,989&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H1&lt;/td&gt;
&lt;td&gt;1,115&lt;/td&gt;
&lt;td&gt;35.6%&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;td&gt;−3,003&lt;/td&gt;
&lt;td&gt;4,029&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H4&lt;/td&gt;
&lt;td&gt;293&lt;/td&gt;
&lt;td&gt;35.8%&lt;/td&gt;
&lt;td&gt;0.81&lt;/td&gt;
&lt;td&gt;−2,237&lt;/td&gt;
&lt;td&gt;2,770&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;D1&lt;/td&gt;
&lt;td&gt;51&lt;/td&gt;
&lt;td&gt;49.0%&lt;/td&gt;
&lt;td&gt;1.55&lt;/td&gt;
&lt;td&gt;+1,546&lt;/td&gt;
&lt;td&gt;1,485&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%2Fj3v6ycrd4rzeatn9qik5.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%2Fj3v6ycrd4rzeatn9qik5.png" alt="TradingView SuperTrend strategy equity curves on NZDUSD for M15, H1, H4 and D1, Jan 2020 to Sep 2026, Exness ticks, spread and commission included" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;This is the part I'd read if I were thinking of running it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It needs a trend, and it needs the right one.&lt;/strong&gt; Here's gold H4 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 H4&lt;/th&gt;
&lt;th&gt;Trades&lt;/th&gt;
&lt;th&gt;Profit factor&lt;/th&gt;
&lt;th&gt;Net (USD per 0.01 lot)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2020–2021&lt;/td&gt;
&lt;td&gt;82&lt;/td&gt;
&lt;td&gt;1.09&lt;/td&gt;
&lt;td&gt;+100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2022–2023&lt;/td&gt;
&lt;td&gt;86&lt;/td&gt;
&lt;td&gt;1.02&lt;/td&gt;
&lt;td&gt;+25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2024–Sep 2026&lt;/td&gt;
&lt;td&gt;99&lt;/td&gt;
&lt;td&gt;3.19&lt;/td&gt;
&lt;td&gt;+3,871&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's four years of roughly break-even, then one very good run. The author said it would struggle in sideways markets, and it did.&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%2Frmsn7oro6s514rud2gkz.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%2Frmsn7oro6s514rud2gkz.png" alt="Profit factor of the SuperTrend strategy by period and timeframe for XAUUSD and NZDUSD, 2020 to 2026, after costs" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the best SuperTrend settings?&lt;/strong&gt; It depends on which years you test, and that's the problem. Over the full test, multiplier 3 looks strong at every ATR period (1.62 to 1.97). Take only 2020–2023, though, and multiplier 2 is the best column (1.29 to 1.47) while the default falls to 1.05. The "best" setting is simply the one that happened to fit the 2024–2026 rally.&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%2F226xsqfsaoum385w45f8.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%2F226xsqfsaoum385w45f8.png" alt="Heatmap of SuperTrend strategy profit factor on XAUUSD H4 by ATR period and multiplier, full test versus 2020 to 2023 only" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A few trades carry the result.&lt;/strong&gt; On gold H1, the five biggest winners add up to +1,493 USD. Take them out and the other 922 trades lose 203 USD. On NZDUSD D1, which is the only green NZDUSD line, three trades make 88% of the profit. Change the multiplier from 3 to 4 there and the profit factor drops to 0.79.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The short side mostly loses.&lt;/strong&gt; On gold, shorts lost money on M15 (−947), H1 (−705) and D1 (−1,466). Only H4 made anything on the short side (+648). So most of what looks like an edge is really the strategy riding a market that went up.&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 closes only when the opposite signal appears, however far price moves first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trades last a while.&lt;/strong&gt; Average hold on gold H4 is 9.0 days (longest 62), and on gold D1 it's 37.9 days (longest 186). NZDUSD H4 averages 8.2 days and NZDUSD D1 averages 47.0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap will make these numbers worse.&lt;/strong&gt; Because the strategy is always in a trade, it pays overnight financing almost every night, triple on Wednesdays, in whichever direction it happens to be. Swap is occasionally positive on one side of a pair. For a system that flips both ways, though, I'd assume it costs you, unless your account is swap-free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drawdown in money terms.&lt;/strong&gt; Gold H4's worst drawdown was 782 USD per 0.01 lot. That's 7.8% of a 10,000 USD account trading 0.01 lot, and 78% at 0.1 lot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What isn't a red flag:&lt;/strong&gt; there's no martingale, no grid and no averaging down. A 35–43% win rate is normal for trend following. Losing streaks of 8 trades on gold H4 and 13 on NZDUSD H1 are normal too.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  So, does SuperTrend work?
&lt;/h2&gt;

&lt;p&gt;On gold during a strong trend, yes. It beat buy and hold by about 1,300 USD per 0.01 lot with half the drawdown, but only because of 2024–2026. On a pair that mostly ranged, like NZDUSD, it didn't, on any timeframe where it traded often enough to judge. The indicator does what it says. It just doesn't find money where there's no trend.&lt;/p&gt;

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

&lt;p&gt;I'd use it as a trend filter or as an exit line inside another system, on gold or other trending instruments on H4. I wouldn't run it on its own on a forex pair. And if you do run it on its own, go in expecting a year or several where it goes nowhere: gold H4 made 125 USD per 0.01 lot across the whole of 2020–2023.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Swap.&lt;/strong&gt; It isn't in any number above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An MT5 Strategy Tester run on real ticks.&lt;/strong&gt; I plan to run gold H4 in MT5 and will update this post with the result.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tick quality.&lt;/strong&gt; In my own check against MT5 ticks, about 23% of archive ticks were shifted by up to 0.30 USD on gold. With trades lasting days, that barely matters, but it isn't zero.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only two instruments.&lt;/strong&gt; I tested gold and one forex pair. I didn't test crypto, even though the author's example chart is BTCUSDT daily, and I didn't test stocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Daily candles.&lt;/strong&gt; My daily bars close at UTC midnight. TradingView's forex daily bars usually close at 17:00 New York, so D1 results won't match a TradingView chart bar for bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TradingView itself.&lt;/strong&gt; I didn't run the script on TradingView, so the "no costs" figures come from my port, not from their tester.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Before swap, the TradingView SuperTrend strategy made money on gold H4 only because gold trended hard in 2024–2026, and it lost on NZDUSD everywhere it traded often. It's a good trend filter and a poor standalone robot.&lt;/p&gt;

&lt;p&gt;Next: &lt;a href="https://moonthetrain.com/lab/supertrend-strategy-optimization-gold" rel="noopener noreferrer"&gt;part 2&lt;/a&gt;, where I keep these entries and change the exits and position sizing on gold H4. After that, another strategy from the same top-100 list.&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;

&lt;p&gt;Originally published at &lt;a href="https://moonthetrain.com/lab/tradingview-supertrend-strategy-backtest" rel="noopener noreferrer"&gt;moonthetrain.com&lt;/a&gt;.&lt;/p&gt;

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