<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Frédéric Gauthier on Medium]]></title>
        <description><![CDATA[Stories by Frédéric Gauthier on Medium]]></description>
        <link>https://medium.com/@fgaut24?source=rss-d0571251affe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8hlzRvukZXeyZs2fmxEOEQ.png</url>
            <title>Stories by Frédéric Gauthier on Medium</title>
            <link>https://medium.com/@fgaut24?source=rss-d0571251affe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:58:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fgaut24/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[J’ai construit un bot de trading et il m’a appris à ne pas l’écouter]]></title>
            <link>https://medium.com/@fgaut24/jai-construit-un-bot-de-trading-et-il-m-a-appris-%C3%A0-ne-pas-l-%C3%A9couter-0df66d03be9d?source=rss-d0571251affe------2</link>
            <guid isPermaLink="false">https://medium.com/p/0df66d03be9d</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[bourse]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[investissement]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Frédéric Gauthier]]></dc:creator>
            <pubDate>Sun, 07 Jun 2026 08:13:27 GMT</pubDate>
            <atom:updated>2026-06-07T08:13:27.544Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*KEfHt0HxRs8bkfXe6-kgLA.jpeg" /></figure><h3>Récit d’une expérimentation, leçons sur les marchés efficients, et pourquoi le market timing reste l’un des mythes les plus tenaces du capitalisme contemporain.</h3><p><em>Cet article raconte une expérimentation menée pendant six semaines, au printemps 2026 : la construction, du code à la mise en production, d’un robot d’analyse boursière algorithmique. Il combinait quatre couches d’analyse — technique, intelligence artificielle, fondamentale, macroéconomique — et envoyait chaque jour à 17h45 un rapport circonstancié sur les 47 principales valeurs cotées à Paris. Le tout sans qu’aucun ordinateur ne soit allumé à mon domicile : l’exécution se faisait dans les nuages, sur l’infrastructure de GitHub.</em></p><p><em>Cet outil fonctionne. Il fonctionne très bien, même. Ses recommandations sont étayées par des indicateurs techniques rigoureux, ses prédictions s’appuient sur un modèle de Machine Learning entraîné selon les règles de l’art — sans biais d’anticipation, validation croisée temporelle, walk-forward backtesting.</em></p><p><em>Et pourtant, après l’avoir testé sur quatre années d’historique boursier, je suis arrivé à une conclusion plus nuancée que je ne l’anticipais : sur les valeurs en tendance haussière soutenue, il aurait sous-performé d’une manière parfois spectaculaire la stratégie la plus bête imaginable — acheter et ne plus rien faire. Sur les valeurs en correction, en revanche, il aurait limité les pertes mieux que cette même stratégie passive. Un comportement défensif réel, donc, mais qui ne suffit pas à battre durablement le marché.</em></p><p><em>Ce n’est pas un échec. C’est, je crois, l’un des résultats les plus intéressants qu’une expérimentation personnelle puisse produire.</em></p><h3>I. Le rêve récurrent du market timing</h3><p>Il existe une intuition profonde, presque universelle, chez quiconque s’intéresse aux marchés financiers : celle de pouvoir, par l’observation attentive des indicateurs disponibles, identifier le bon moment pour acheter et le bon moment pour vendre. Acheter bas, vendre haut.</p><p>Cette intuition porte un nom dans le jargon financier : le <strong>market timing</strong>. Elle constitue l’opposé d’une autre approche, celle de la gestion passive ou Buy &amp; Hold — on achète des actifs représentatifs du marché (un ETF mondial), on les conserve dans la durée, et on accepte les fluctuations comme le prix à payer pour capter la croissance économique de long terme.</p><p>Depuis les années 2010, une nouvelle promesse s’est superposée à l’ancienne : celle du Machine Learning. Avec suffisamment de données et un algorithme capable d’apprendre, ne pourrait-on pas faire mieux que les indicateurs traditionnels ? Sur Reddit, sur YouTube, des milliers de créateurs proposent des recettes, des bots, des signaux. Le mythe est puissant.</p><p>Au printemps 2026, j’ai décidé de regarder ce mythe en face — non pas pour le contester par principe, mais pour le tester par moi-même, sur mes propres données, avec mes propres outils.</p><h3>II. Anatomie du bot</h3><p>Le système développé — baptisé Oracle Quantamental — combinait quatre couches d’analyse.</p><p><strong>La couche technique</strong> calculait une batterie d’indicateurs classiques : RSI (qui mesure si un actif est en zone de survente ou de surachat), MACD (qui détecte les changements de momentum), bandes de Bollinger (qui encadrent le prix par sa volatilité), ATR (qui mesure la volatilité quotidienne) et OBV (qui croise prix et volumes).</p><p><strong>La couche Machine Learning</strong> entraînait un modèle Random Forest sur l’historique des séances passées, apprenant à associer sept variables explicatives à une prédiction binaire : le prix va-t-il monter ou baisser dans les cinq séances suivantes ? Pour éviter le piège du look-ahead bias, j’ai utilisé un walk-forward backtesting : le modèle ne s’entraîne qu’avec les données strictement antérieures à la date évaluée.</p><p><strong>La couche fondamentale</strong> intégrait le PER (Price-Earning Ratio) et la marge opérationnelle de chaque action, pour ancrer l’analyse dans la valeur économique réelle de l’entreprise.</p><p><strong>La couche macroéconomique</strong> récupérait en temps réel le VIX (indice de la peur des marchés) et le taux à dix ans américain, définissant quatre régimes de marché : 🟢 Calme, 🟡 Vigilance, 🟠 Tension, 🔴 Panique.</p><p>Ces quatre couches convergeaient vers un score de conviction de 0 à 10. Une conviction supérieure à 7 signalait une opportunité ; en dessous de 3, un risque.</p><p>L’ensemble tournait automatiquement sur GitHub Actions, analysait les 47 valeurs du CAC 40 plus sept ETF PEA, et m’envoyait son rapport sur Telegram chaque soir à 17h45 — sans que je touche quoi que ce soit.</p><h3>III. L’épreuve de vérité : le backtest</h3><p>Pour savoir si le bot battait vraiment le marché, j’ai développé un second programme simulant rigoureusement la stratégie sur quatre années d’historique (2022–2026), avec deux contraintes absolues : aucun look-ahead bias, et intégration systématique des frais de transaction (0,15 % par opération) et de la fiscalité PEA.</p><p>Les résultats sur six actifs représentatifs du CAC 40 :</p><p>ActifContexteStratégieBuy &amp; HoldÉcartLVMHBear market−8,9 %−36,1 %<strong>+27,2 %</strong> ✅L’OréalConsolidation+1,3 %−11,4 %<strong>+12,7 %</strong> ✅SanofiConsolidation+8,7 %−7,4 %<strong>+16,0 %</strong> ✅TotalEnergiesBull market−15,0 %+27,0 %<strong>−41,3 %</strong> ❌Air LiquideBull−11,2 %+9,4 %<strong>−20,5 %</strong> ❌Schneider Elec.Bull volatil−0,2 %+25,9 %<strong>−26,1 %</strong> ❌</p><p>La lecture est saisissante. Sur les actifs en baisse, le bot a brillé. Sur les actifs en hausse, il a sorti trop tôt à chaque signal de surachat, manquant la continuation. Et au-dessus de tout : l’ETF MSCI World affichait <strong>+32,8 %</strong> sur la même période, avec un ratio de Sharpe de 0,83 — performance qu’aucune stratégie active n’a approchée.</p><h3>IV. Pourquoi le market timing échoue : trois explications économiques</h3><p><strong>1. L’asymétrie temporelle des marchés</strong></p><p>Les marchés ne montent pas régulièrement — ils montent par à-coups, concentrés sur un nombre étonnamment réduit de séances. Manquer les dix meilleures séances d’une année réduit le rendement annualisé de moitié. Ces meilleures séances surviennent souvent juste après des phases de fort stress. L’investisseur actif qui a coupé sa position arrive inévitablement trop tard au rebond.</p><p><strong>2. Les coûts de friction</strong></p><p>Chaque aller-retour coûte : courtage, spread, fiscalité. Sur TotalEnergies, le bot a généré 30 transactions en deux ans — soit près de 10 % du capital initial parti en frottements. La gestion passive, au contraire, ne génère quasiment aucun frais.</p><p><strong>3. La concurrence asymétrique</strong></p><p>Quand vous achetez une action, votre contrepartiste n’est presque jamais un autre particulier : c’est un hedge fund quantitatif, des serveurs co-localisés à quelques mètres physiques des bourses, des équipes de centaines de docteurs en mathématiques. Mon bot, dans ce contexte, ressemble à une trottinette face à une Formule 1.</p><blockquote>« Tous les investisseurs cherchent à battre le marché. Mais le marché, c’est exactement la moyenne des résultats de tous les investisseurs. Avant frais, l’investisseur moyen obtient donc, par définition mathématique, exactement la performance du marché. Après frais, il obtient nécessairement moins. »<em> — Reformulation du théorème de William Sharpe, Prix Nobel 1990.</em></blockquote><h3>V. Pourquoi nous persistons quand même : la psychologie de l’investisseur</h3><p>Si les arguments économiques sont si convaincants, pourquoi tant d’investisseurs s’obstinent-ils ? La finance comportementale, fondée par Daniel Kahneman (Prix Nobel 2002) et Amos Tversky, identifie quatre biais cognitifs convergents.</p><p><strong>La sur-confiance.</strong> L’étude de Barber et Odean (Journal of Finance, 2000) sur 66 000 comptes-titres montre que les 20 % d’investisseurs les plus actifs obtiennent un rendement net inférieur de 6,5 points par an aux 20 % les moins actifs. La différence ne vient pas de mauvais choix de titres — mais du surcroît de transactions généré par la conviction injustifiée d’avoir un avantage informationnel.</p><p><strong>Le biais de récence.</strong> Nous accordons un poids disproportionné aux événements récents. Sur un horizon de quelques mois à quelques années, les actifs récemment haussiers ont tendance à corriger. Le biais de récence pousse à acheter haut et à vendre bas — exactement le contraire du précepte de bon sens.</p><p><strong>L’illusion du contrôle.</strong> Le sentiment de contrôle — choisir, analyser, décider — procure une gratification psychologique réelle, indépendante du résultat financier. C’est sans doute la raison la plus profonde du succès du market timing : il satisfait un besoin émotionnel d’agir, même quand l’action ne sert à rien, voire nuit.</p><p><strong>L’aversion à la perte.</strong> Kahneman et Tversky ont démontré que la douleur ressentie en perdant 100 € est environ deux fois plus forte que le plaisir ressenti en gagnant la même somme. Ce biais pousse à vendre trop vite en cas de baisse, et à conserver trop longtemps les titres perdants.</p><p>J’ai observé ces biais à l’œuvre sur moi-même à chaque étape du projet. Construire le bot a sans doute été moins formateur pour mes finances que pour ma compréhension de mon propre fonctionnement face à l’argent.</p><h3>VI. Ce que le bot apprend vraiment : éloge inattendu de la gestion défensive</h3><p>Faut-il pour autant jeter le bot ? Non. Le backtest révèle quelque chose d’intéressant : sur les actifs en correction ou en consolidation, sa logique de retour à la moyenne fonctionne. Il protège le capital et peut produire un rendement positif là où Buy &amp; Hold perd lourdement.</p><p>Mais cette observation a une limite cruciale : personne ne sait à l’avance quel actif va baisser et lequel va monter. La stratégie défensive du bot prouve son utilité <em>ex post</em>, sur l’historique. Elle ne dit rien de ce qu’il faut faire <em>ex ante</em>.</p><p>Son véritable apport est donc différent de ce que j’espérais. Ce n’est pas un générateur de décisions — c’est un <strong>système de veille</strong>. Il m’informe quotidiennement de l’état technique du marché. Il signale les zones extrêmes. Il contextualise. Tout cela a de la valeur, mais à condition de ne jamais le suivre mécaniquement.</p><h3>VII. Une tentation, et un piège déjoué en direct</h3><p>Face aux résultats décevants sur les actifs haussiers, la tentation était naturelle : améliorer le bot. Deux idées s’imposaient — un filtre de régime empêchant de vendre une valeur en tendance haussière, et un stop suiveur adaptatif.</p><p>Pour évaluer ces variantes sans curve-fitting, j’ai imposé un protocole strict : <strong>split temporel verrouillé</strong>. L’historique est coupé en deux moitiés étanches. Sur la première (entraînement), on explore librement. Sur la seconde (test), on ne regarde qu’une seule fois, sans réajustement possible.</p><p>Sur la période d’entraînement, les résultats étaient prometteurs. Le filtre de régime faisait passer le rendement de +3,5 % à +6,9 %. Si je m’étais arrêté là — comme le font la plupart des outils vendus en ligne — j’aurais déployé une stratégie dégradée sans le savoir.</p><p>Sur la période de test, le verdict fut sans appel : l’amélioration ne tenait pas. Le stop suiveur, sur TotalEnergies, faisait chuter le rendement de +15,7 % à +0,1 %. Les beaux chiffres de l’entraînement n’étaient que du bruit déguisé en signal.</p><blockquote>« Si vous torturez les données assez longtemps, elles finiront par avouer n’importe quoi. »<em> — Aphorisme attribué à Ronald Coase ou George Stigler ; formulation exacte et auteur original débattus.</em></blockquote><p>La décision fut de ne rien intégrer. Le bot reste dans sa version d’origine. Une expérimentation qui ne peut jamais échouer n’apprend rien.</p><h3>VIII. Et maintenant ?</h3><p>La stratégie statistiquement supérieure n’est ni excitante ni gratifiante : acheter régulièrement un ETF mondial (le MSCI World coûte 0,25 % de frais annuels), dans un PEA, et ne plus rien faire pendant quinze ans. Pas d’analyse technique, pas de Machine Learning, pas de Random Forest. Rien.</p><p>Cette conclusion heurte un biais cognitif puissant. Nous avons spontanément tendance à croire que plus une stratégie est sophistiquée, plus elle doit être performante. La réalité empirique infirme cette intuition.</p><p>Je maintiens le bot comme outil de veille sur les actifs que je détiens. Il m’informe — il ne me commande pas. La distinction est peut-être la chose la plus utile que ce projet m’ait apprise.</p><blockquote>« La meilleure marque d’intelligence en matière de placement est d’investir l’argent sur lequel on ne peut se permettre de spéculer. »<em> — Benjamin Graham, L’Investisseur intelligent (1949).</em></blockquote><p><em>Frédéric Gauthier est professeur de Sciences économiques et sociales. Le code complet du bot et du protocole de backtest est disponible publiquement sur GitHub (fgaut24/mon-trading-bot). ⚠️ Cet article ne constitue en aucun cas un conseil en investissement. Les performances passées ne préjugent pas des résultats futurs.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0df66d03be9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Trading Bot — and It Taught Me Not to Listen to It]]></title>
            <link>https://medium.com/@fgaut24/i-built-a-trading-bot-and-it-taught-me-not-to-listen-to-it-44b2a99792e9?source=rss-d0571251affe------2</link>
            <guid isPermaLink="false">https://medium.com/p/44b2a99792e9</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[investing]]></category>
            <dc:creator><![CDATA[Frédéric Gauthier]]></dc:creator>
            <pubDate>Sat, 06 Jun 2026 11:15:54 GMT</pubDate>
            <atom:updated>2026-06-06T11:15:54.951Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*KEfHt0HxRs8bkfXe6-kgLA.jpeg" /></figure><h3>Six weeks of algorithmic experimentation, a rigorous backtest, and what fifty years of academic research keeps telling us about market timing — confirmed on my own data.</h3><p><em>This article documents an experiment I ran over six weeks in spring 2026: building, from code to production, an algorithmic stock-analysis system. It combined four layers of analysis — technical, artificial intelligence, fundamental, and macroeconomic — and sent a daily report on 47 Paris-listed securities to my phone at 5:45 PM, automatically, without any computer running at home. Everything executed in the cloud on GitHub’s infrastructure.</em></p><p><em>The system works. It works very well, in fact. Its recommendations are backed by rigorous technical indicators; its predictions rely on a Machine Learning model trained according to best practices — no look-ahead bias, temporal cross-validation, walk-forward backtesting.</em></p><p><em>And yet, after testing it against four years of market history, I reached a more nuanced conclusion than I anticipated: on assets in sustained upward trends, it would have dramatically underperformed the dumbest possible strategy — buy and do nothing. On assets in correction or consolidation, it genuinely limited losses better than passive holding. A real defensive edge, then — but not enough to beat the market durably.</em></p><p><em>That’s not a failure. It’s, I think, one of the most interesting results a personal experiment can produce.</em></p><h3>I. The Enduring Fantasy of Market Timing</h3><p>There’s a deep, almost universal intuition among anyone who follows financial markets: that by carefully watching the right indicators, you can identify the right moment to buy and the right moment to sell. Buy low, sell high.</p><p>This intuition has a name in financial jargon: <strong>market timing</strong>. It’s the opposite of passive investing — buying a broad market index, holding it through fluctuations, and capturing long-term economic growth without trying to predict short-term moves.</p><p>Since the 2010s, a new promise has layered on top of the old one: Machine Learning. With enough data and a capable algorithm, couldn’t we extract signals that traditional indicators miss? The Renaissance Technologies mythology, Reddit threads, YouTube channels, paid signal services — the fantasy is everywhere and powerful.</p><p>In spring 2026, I decided to look this fantasy directly in the eye — not to dismiss it on principle, but to test it on my own data, with my own tools, under conditions I could fully audit.</p><h3>II. Inside the Bot</h3><p>The system — internally nicknamed Oracle Quantamental — combined four analytical layers.</p><p><strong>The technical layer</strong> computed a standard battery of indicators: RSI (measuring overbought/oversold conditions), MACD (detecting momentum shifts), Bollinger Bands (framing price within its volatility envelope), ATR (daily volatility), and OBV (price-volume relationship).</p><p><strong>The Machine Learning layer</strong> trained a Random Forest model on historical sessions, learning to associate seven input features with a binary prediction: will the price be higher or lower five trading sessions from now? To prevent look-ahead bias — the most common and most damaging methodological error in quantitative finance — I used walk-forward backtesting: the model only ever trains on data strictly prior to the date being predicted, and retrains every 20 sessions.</p><p><strong>The fundamental layer</strong> incorporated each stock’s trailing P/E ratio and operating margin, anchoring the analysis in the actual economic value of the underlying business rather than just price patterns.</p><p><strong>The macroeconomic layer</strong> fetched real-time VIX (fear index) and US 10-year yields, defining four market regimes: 🟢 Calm, 🟡 Watchful, 🟠 Stressed, 🔴 Panic — each shifting the conviction score accordingly.</p><p>All four layers converged into a single conviction score from 0 to 10, alongside entry levels, price targets, and stop-losses calibrated to each asset’s own volatility.</p><p>The whole system ran automatically on GitHub Actions, analyzed 47 securities daily, and sent its report to Telegram every evening — without me touching anything.</p><h3>III. The Moment of Truth: The Backtest</h3><p>To know whether the bot actually beat the market, I built a separate backtesting program that rigorously simulated the strategy over four years of historical data (2022–2026), with two absolute constraints: no look-ahead bias, and systematic inclusion of transaction costs (0.15% per trade) and French PEA tax (17.2% on capital gains after five years).</p><p>The benchmark was not just Buy &amp; Hold on the individual stock — it also included the MSCI World ETF, the real judge of any active strategy claiming to beat diversified passive investing.</p><p>Results across six representative CAC 40 stocks:</p><p>AssetContextActive StrategyBuy &amp; HoldGapLVMHBear market−8.9%−36.1%<strong>+27.2%</strong> ✅L’OréalConsolidation+1.3%−11.4%<strong>+12.7%</strong> ✅SanofiConsolidation+8.7%−7.4%<strong>+16.0%</strong> ✅TotalEnergiesBull market−15.0%+27.0%<strong>−41.3%</strong> ❌Air LiquideBull−11.2%+9.4%<strong>−20.5%</strong> ❌Schneider Elec.Volatile bull−0.2%+25.9%<strong>−26.1%</strong> ❌</p><p>The pattern is striking. On falling assets, the bot excelled — cutting maximum drawdown by two to three, and generating positive returns where Buy &amp; Hold bled. On rising assets, it exited too early at every overbought RSI signal, missing the continuation of the trend entirely.</p><p>And above everything: the MSCI World ETF returned <strong>+32.8%</strong> over the same period, with a Sharpe ratio of 0.83 — a performance no active strategy came close to matching.</p><h3>IV. Why Market Timing Fails: Three Economic Explanations</h3><p><strong>1. The temporal asymmetry of markets</strong></p><p>Markets don’t rise steadily — they surge in bursts concentrated in a remarkably small number of sessions. Missing the ten best trading days of each year roughly halves annualized returns. These best sessions tend to occur immediately after periods of intense stress. The passive investor is mechanically present for the rebound; the active investor who cut positions must decide when to re-enter — and research consistently shows they re-enter too late.</p><p><strong>2. The friction tax</strong></p><p>Every trade costs money: brokerage fees, bid-ask spread, taxes. On TotalEnergies, the bot generated 30 round-trips over two years — roughly 10% of initial capital gone to friction before a single cent of alpha. Passive investing generates almost no friction: one ETF purchase per month, costs of 0.25% per year.</p><p><strong>3. Asymmetric competition</strong></p><p>When you buy or sell a stock, your counterparty is almost never another retail investor. It’s a market maker, a quant hedge fund, or a pension fund. These actors run co-located servers microseconds from exchange matching engines, employ hundreds of PhDs in mathematics and AI, and analyze terabytes of alternative data. My bot, in this context, is a scooter entering a Formula 1 race.</p><blockquote>“All investors seek to beat the market. But the market is exactly the average of all investors’ results. Before costs, the average investor therefore earns, by mathematical definition, exactly market returns. After costs, they necessarily earn less.”<em> — Reformulation of William Sharpe’s arithmetic of active management, Nobel Prize 1990.</em></blockquote><h3>V. Why We Keep Trying Anyway: The Psychology</h3><p>If the economic arguments are so clear, why do millions of retail investors persist? Behavioral finance, founded by Daniel Kahneman (Nobel 2002) and Amos Tversky, identifies four converging cognitive biases.</p><p><strong>Overconfidence.</strong> Barber and Odean’s landmark 2000 study in the <em>Journal of Finance</em>, tracking 66,000 individual brokerage accounts over six years, found that the most active 20% of investors earned 6.5 percentage points less per year than the least active 20%. The difference didn’t come from bad stock picks — it came from excessive trading driven by unjustified conviction of informational advantage.</p><p><strong>Recency bias.</strong> We systematically overweight recent events. On short to medium horizons, recently surging assets tend to revert; recently declining assets tend to bounce. Recency bias pushes investors to buy high and sell low — the precise opposite of the common-sense principle.</p><p><strong>Illusion of control.</strong> The act of choosing, analyzing, deciding provides real psychological gratification independent of financial results. This is perhaps the deepest reason market timing persists: it satisfies an emotional need to act, even when acting is counterproductive.</p><p><strong>Loss aversion.</strong> Kahneman and Tversky demonstrated that the pain of losing €100 is roughly twice as intense as the pleasure of gaining the same amount. This asymmetry pushes investors to sell falling positions too quickly (to stop the pain) and hold losing positions too long (because selling would make the loss “real”).</p><p>I watched all four biases operate on myself throughout this project. Building the bot may have been less educational for my finances than for my understanding of my own psychology around money.</p><h3>VI. What the Bot Actually Gets Right</h3><p>Should we abandon the bot entirely? Not necessarily. The backtest reveals something genuinely interesting: on assets in correction or extended consolidation, the mean-reversion logic works. It protects capital and can produce positive returns where Buy &amp; Hold loses significantly.</p><p>But this observation has a critical limitation: nobody knows in advance which assets will fall and which will rise. The bot’s defensive value is proven <em>ex post</em>, on historical data. It says nothing about what to do <em>ex ante</em>.</p><p>Its real value, then, is different from what I originally hoped. It’s not a decision generator — it’s a <strong>monitoring system</strong>. It keeps me informed about the technical state of the market. It flags extremes. It contextualizes. That has real value, as long as I never follow it mechanically.</p><h3>VII. A Temptation — and a Methodological Trap, Caught in Real Time</h3><p>Facing disappointing results on trending assets, the natural impulse was to improve the system. Two ideas suggested themselves: a regime filter preventing sells during confirmed bull trends, and an ATR-based trailing stop replacing the binary exit rule.</p><p>To evaluate these variants without falling into curve-fitting, I imposed a strict protocol: <strong>locked temporal split</strong>. The full dataset was divided into two hermetically sealed halves. On the first (training), free exploration was allowed. On the second (test), only one look was permitted — after finalizing decisions, with no adjustments possible afterward.</p><p>On the training period, results were encouraging. The regime filter raised returns on one bullish asset from +3.5% to +6.9% while cutting trades from fifteen to four. If I had stopped there — as virtually every online trading tool does, showing only optimized backtests — I would have triumphed and deployed a degraded strategy.</p><p>On the test period, the verdict was unambiguous: the improvement didn’t hold. The trailing stop, on TotalEnergies, collapsed returns from +15.7% to +0.1%. The regime filter was neutral at best. Neither idea produced robust improvement confirmed across both periods. The promising training numbers were noise masquerading as signal.</p><blockquote>“If you torture the data long enough, it will confess to anything.”<em> — Commonly attributed to Ronald Coase or George Stigler; exact authorship debated.</em></blockquote><p>The decision was to integrate nothing. The bot stays in its original version. An experiment that can never fail teaches nothing.</p><h3>VIII. What Now?</h3><p>The statistically superior strategy is neither exciting nor gratifying: buy a globally diversified ETF (MSCI World, at 0.25% annual cost), in a tax-advantaged account, and do absolutely nothing for fifteen years. No technical analysis. No Machine Learning. No Random Forest. Nothing.</p><p>This conclusion collides with a powerful cognitive bias: the intuition that more sophisticated strategies must perform better. The empirical evidence consistently refutes this intuition.</p><p>The SPIVA reports (S&amp;P Indices Versus Active), published semi-annually, confirm this with uncomfortable regularity: over fifteen years, roughly 90% of actively managed funds underperform their benchmark index after fees. These are full-time professional managers with teams, infrastructure, and resources far beyond anything available to a retail investor building weekend projects.</p><p>I keep the bot running as a monitoring tool for positions I already hold. It informs — it doesn’t command. That distinction may be the most useful thing this entire project taught me.</p><blockquote>“The best measure of intelligence in investment matters is to invest money you cannot afford to speculate with.”<em> — Benjamin Graham, The Intelligent Investor (1949).</em></blockquote><p><em>Frédéric Gauthier is a certified teacher of Economics and Social Sciences. The complete code for the bot and the backtesting protocol is publicly available on GitHub (fgaut24/mon-trading-bot). ⚠️ This article does not constitute investment advice. Past performance does not predict future results.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44b2a99792e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>