{"id":"2082095561176703135","url":"https://x.com/milesdeutscher/status/2082095561176703135","text":"","author":{"name":"Miles Deutscher","username":"milesdeutscher","avatarUrl":"https://pbs.twimg.com/profile_images/2043255869513601025/wFHeLjZX_200x200.jpg"},"createdAt":"Tue Jul 28 13:27:19 +0000 2026","engagement":{"replies":12,"retweets":47,"likes":240,"views":209891},"article":{"title":"How to Backtest Winning Trading Strategies (Claude + TradingView) ","previewText":"Claude + TradingView is extremely powerful - I wish more people knew this existed.\nIf you're struggling to become a profitable trader, this is one of the most valuable systems I could give you.\nI","coverImageUrl":"https://pbs.twimg.com/media/HORHRexbcAABx62.jpg","content":"Claude + TradingView is extremely powerful - I wish more people knew this existed.\n\nIf you're struggling to become a profitable trader, this is one of the most valuable systems I could give you.\n\nI recently backtested 432 trading strategies with Claude, found a winner, took it to the live markets, and made +$19,537.\n\nIn this article, I'm revealing the entire process and how you can copy me to find, build & automate real winning trading strategies for yourself.\n\nWhat you'll learn:\n\n- Where to find trading strategies worth testing \n\n- How to turn any idea into Pine Script \n\n- How to backtest it inside TradingView (based on real data)\n\n- How to get Claude to analyse & improve your strategy\n\nIf you stick around until the end of this article, I'll directly send you the GitHub link to the custom Research Desk I personally built - it helps you find, build and automate trading strategies using real market data (already has 500 trading strategies loaded in). \n\n![Research Desk](https://pbs.twimg.com/media/HORMfanbAAAuuMx.jpg)\n\nWith that out of the way, let's jump right into things:\n\n## Finding Trading Strategies Worth Testing\n\nThe first step in this system is finding trading strategies that are actually worth backtesting. This is the base for everything else that will follow, and the most important piece for building a profitable strategy. \n\nYou do not need to invent something from scratch, and honestly I would recommend against it (although I will show you how to do this too). \n\nIdeally, you start with something that already exists, then improve it over time based on its backtested results. \n\nYou have three solid options for finding trading strategies:\n\n1. TradingView's Public Library\n\nTradingView hosts thousands of free, open-source strategies you can study, copy, and modify. It is the fastest place to find ideas, and you can see how each one has performed before you commit to testing it properly.\n\nJust head to https://www.tradingview.com/scripts/?script_type=strategies\n\n2.     GitHub\n\nGitHub is full of free TradingView Pine Script repositories. Ranging from simple RSI setups to advanced trend-following systems. \n\nYou can save a few directly. I did a simple search on GitHub and found 250+ strategies that were ready to go. \n\n3. Build your own with Claude\n\nIf you already have a trading idea in your head (or better yet, an actual strategy), you can actually turn it into a set of rules, and then turn those rules into Pine Script that can be imported into TradingView.\n\n![Building strategies with Claude](https://pbs.twimg.com/media/HORU9PxboAAzkI6.png)\n\nIf you're interested in this method, I did a full write-up with a real example here:\n\nTL;DR: \n\n- Brain dump your trading strategy into Claude\n\n- Turn that brain dump into a set of rules (entry rules, exit rules) \n\n- Turn that .md text into Pine Script to be imported into TradingView for testing\n\nThe point of this phase isn't to find or build a crazy profitable strategy (we'll get into that). The point here is simply to source a few interesting trading ideas and strategies that we can build upon.\n\nMy recommendation is to save a few highly rated strategies from TradingView's library and/or popular public GitHub repos. \n\n## Turning Strategies Into Pine Script\n\nNow you have a strategy; you need something you can actually backtest.  \n\nPine Script is TradingView's native coding language. You do not need to learn it; you just need Claude to write it for you.  \n\nI want you to open Claude with your strategy handy and paste this prompt:  \n\nI used a $100,000 portfolio for this step, but feel free to modify the prompt to suit the portfolio size you would actually have - the more accurate you are here, the more accurate the backtested results will be. \n\nWithin seconds, you'll have a complete strategy you can drop straight into TradingView (the next step).\n\n![Real output (Claude turning a strategy into Pine Script)](https://pbs.twimg.com/media/HORSv6EaUAAfEXe.jpg)\n\n## Running the Backtest \n\nThis is where you get to see how the strategy you selected would have actually performed.  \n\nCopy the entire Pine Script Claude generated, then follow these steps:\n\n1. Open TradingView\n\n2.    Click Pine Editor at the top of your screen  \n\nClick \"Create Script.\" \n\n![Create script](https://pbs.twimg.com/media/HORTwEoakAAuc6Q.jpg)\n\n3.     Paste the Pine Script code\n\nOnce pasted, click \"Add To Chart.\"\n\n![Pasting Pine Script in](https://pbs.twimg.com/media/HORT5i3boAAGg-0.png)\n\nThat is it; TradingView now simulates every trade the strategy would have taken and shows you the full historical performance.  \n\nReal Example\n\nMean-Reversion RSI Strategy (from my article linked earlier):\n\n![Backtesting data](https://pbs.twimg.com/media/HORURoLaQAAEvpL.jpg)\n\nNote: sometimes the code will not compile on the first attempt. This is normal and not a problem. My recommendation is to copy the error message, or just screenshot it, paste it back into  Claude, and ask for a fix. \n\nFrom here, you can scroll through the entire historical performance of a trading strategy.\n\nThings to look for \n\nNet Profit: how much the strategy made or lost overall (relative to your portfolio size - as established in the above prompt).\n\nWin Rate: the % of trades that were winners.  \n\nMax Drawdown: the largest peak-to-trough decline the strategy suffered.  \n\nProfit Factor: how much profit it generated for every dollar lost (above 1 means profitable, and the higher the better). \n\nNumber of Trades: the sample size behind everything above.\n\nI recommend repeating this process of importing Pine Scripts into TradingView at least 3-5 times and saving the most profitable strategy you find.\n\nI actually built a custom Research Desk and backtested 432 strategies (using Fable 5), and it took weeks, but it was worth it.\n\nThe point is, the more the better, because in the next steps we'll build on the winning strategy and make it even better.\n\n## Letting Claude Analyse & Refine\n\nThis is the step almost nobody does, and it is where the real value is.\n\nTradingView gives you the summary of how the strategy would have performed, but what it does not tell you is why. \n\nWhy the strategy lost when it lost, what conditions broke it, and what would actually fix it.\n\nInstead of manually reviewing hundreds of trades, hand the whole thing to Claude.\n\nInside TradingView, click Export and download your complete trade history as a CSV. \n\n![Saving as CSV](https://pbs.twimg.com/media/HORXQCqbcAA2YuW.png)\n\nThen, upload that file into Claude and start asking real questions.\n\nPrompts to ask\n\n\"Why did this strategy underperform?\"\n\n\"Which market conditions caused the biggest losses?\"\n\n\"How can I reduce the drawdown?\"\n\n\"How would you improve this strategy without overfitting?\"\n\nClaude then explains why your strategy performed the way it did, which is the part that actually makes you a better trader.\n\nFrom here, you can repeat the above process of turning the revised trading strategy into Pine Script, backtesting it inside TradingView, and comparing results. \n\n## My Research Desk\n\nHopefully, you see the power in this system.\n\n99% of traders risk real capital in the market without having a clue if the strategy they're using is even historically profitable.\n\nThis system I just showed you eliminates that key flaw and enables you to figure out if a strategy is actually profitable BEFORE risking any real money behind it. \n\nThere is a way to make this system even more powerful though: \n\nBuild a Research Desk that automates this entire process. \n\nOf course, you can do this yourself, but to save you the headache, I just open-sourced my entire personal Research Desk app. \n\nIn this custom app, you can directly access 500+ trading strategies, test them against each other, import them via Pine Script, and refine them using AI - all in one place. \n\nTo access the Research Desk, I only ask two things:\n\n1. Sign up for my free market newsletter (100% free, no spam ever)\n\n1. Join my free market Telegram community \n\nTo get started, use this link, and I'll share the app with you directly:\n\n[https://milesdeutscher.com.au/ytjlve](https://www.youtube.com/redirect?event=video_description&redir_token=QUM4Zm9rUVdZclo3N3NhU0xZVnh5QWszZVVPaHxBR3JiS2FsMUJYZkNBTk1feDJZZ1VqQ0Jqai1OQnVfNVgxM200ZVlKR2NNUDdvOGNjdVl0bHp6Y1p1eVhHQTVTNllIUlo4am9LZ3RnaXJ6OWhDWVY0M3UtYkl2dnNYNENGVHNU&q=https%3A%2F%2Fmilesdeutscher.com.au%2Fytjlve&v=YsBGfETp3OM)\n\nBy doing these two things, it guarantees that I can keep bringing high-value free content like this!\n\n## Wrapping Up\n\nI hope you found this article valuable.\n\nIf you did, be sure to follow me here @milesdeutscher - every single week, I post several deep dive articles on how you can leverage AI in the financial markets.\n\nFor deeper AI insights, follow me over on @aiedge_. \n\nLastly, if you have any content suggestions, feel free to leave a reply below - I read every one, and it genuinely shapes what I write about next.\n\nThank you for making it this far.\n\n-Miles💙"}}