In Part 1 of this series, we looked at how to use Large Language Models as your personal junior developer, translating plain English trading ideas into functioning TradingView Pine Script.
It is an incredible unlock. But once you have that custom indicator printing on your chart, the next logical question inevitably follows: “Can I just hand this to the AI and have it backtest the whole thing for me?”
The short answer is yes. The realistic answer is: be very, very careful.
Today, we are looking at the reality of using AI for strategy optimization. It is an incredibly powerful tool for accelerating your learning curve and finding the right parameters, but if you treat it as an infallible backtesting engine, it will happily walk your portfolio right off a cliff.
The “Improv Actor” Problem
AI models have a fundamental psychological quirk: they are eager to please. They operate heavily on the first rule of improv comedy—“Always say yes, and…” If you ask an AI to find a profitable pattern in a sea of random noise, it will often “find” one just to give you the answer you are looking for. We have all seen the headlines about lawyers using AI to draft legal briefs, only for the judge to discover the AI entirely fabricated the cited case law. It didn’t know the answer, so it hallucinated a plausible-sounding lie.
The exact same thing happens in trading.
A while back, I was on a business trip, sitting in a hotel room bored out of my mind in a hotel room. So I start looking at a 15-minute chart with a new custom indicator. I thought I saw the beginnings of an edge. One of those situations where the indicator rises and falls in sync with price – but is it useful? Or just a mirror? It felt like there was something there – you know the feeling. “When the indicator does this – more often than not, price does that.”
Now sorting through this can take a long time, and we humans can be prone to confirmation bias. So I thought – maybe AI can sift through some data and give me a nudge in the right direction. I took five screenshots—representing about 15 days of price action—fed them into Grok, and gave it a strict prompt: Analyze this for a tradable edge. If one exists, define the exact rules for entry, exit, and stop-loss, and quantify the results. My goal was to develop a simple system I could activate, and then go work on other things. When the alerts triggered, I would have a very simple checklist to look at to decide if this was a trade to take, what levels to set my Take Profit and Stop Loss at, and then go back to work. It was a system for when I didn’t have time to focus fully on trading. (A Sentinel System, if you will)
Grok nailed it. It identified the pattern and spit out a highly logical, rule-based system. It was genuinely useful.
So, I got greedy. I started feeding it batch after batch of screenshots, asking it to continue the backtest. For a while, it worked. But then, the context window filled up, the model got overwhelmed, and things got suspicious. It started spitting out win rates and Risk/Reward ratios that were simply too consistent. Markets are chaotic; you don’t get the exact same distribution of wins and losses every three days. Grok had stopped analyzing and started hallucinating a perfect, agreeable outcome.
The initial edge was real (and I still use a modified version of it today), but the prolonged AI backtest was garbage. I mean, it was telling me, with all earnestness, that each batch of 15 days of data was giving the same win rate, to the 2nd decimal place. That’s when I knew for sure something had gone off the rails.
The golden rule of AI: You must genuinely know your field so you can spot the hallucinations. You are the trader. The AI is just the assistant.
How to Actually Use AI for Optimization
If you shouldn’t trust it to run the full backtest, where does AI actually fit into the optimization process?
1. The Learning Accelerator If you are trying to build a strategy and you hit a wall—maybe you are reading an academic paper on a new volatility model, or trying to understand the math behind a complex moving average—feed the article to your AI. Ask it to simplify, summarize, and provide trading examples. Let it bridge your knowledge gaps so you can build a better system.
2. Parameter Identification (The Real Cheat Code) This is where AI shines. Do not ask it to test the strategy; ask it what you should be testing.
Take your Pine Script code and a screenshot of the indicator’s input settings, and feed them to the AI. Ask: “Based on this strategy’s logic, which two or three variables will have the highest impact on profitability? Give me a range of values to test for each.”
The AI will parse the math and tell you exactly which dials actually move the needle.
3. The Strategy Tester (Where the Truth Lives) Once the AI tells you what to test, you take those parameters and plug them into TradingView’s native Strategy Tester.

Above: The output of a properly optimized strategy in TradingView.
When you run a real, algorithmic backtest, you get cold, hard data. Look at the equity curve in the image above. The final result is fantastic: a +40% gain and a respectable 1.14 profit factor over nearly 400 trades.
But look closer at the red.
Right in the middle of that chart, there is a brutal, extended drawdown. The AI might tell you this is a mathematically winning strategy, but only you can look at that chart and ask: “Do I have the psychological fortitude to trade this system flawlessly while my account bleeds for five months straight?”
No language model can answer that for you. Consider the sheer brute force required to run an AI: it takes warehouses stacked with silicon, massive cooling towers, and literal megawatts of electricity just to guess the next word in a sentence based on statistical probability. It is a wildly energy-hungry pattern-matching machine.
But you—the real trader—are operating with natural intelligence, powered by the most complex structure in the known universe. Your brain runs 86 billion neurons across roughly 100 trillion synaptic connections, all humming along on about 20 watts of power. You are running the ultimate analytical engine on the energy equivalent of a dim desk lamp.
Because of that biological efficiency, your brain doesn’t just blindly calculate historical data; it synthesizes context. It has the neuroplasticity to adapt in real-time. It can feel the friction in the tape, process subtle shifts in volume, and intuitively recognize when a market transitions from an accumulation phase into a new markup cycle. You can take the data further. You can look at that equity curve and ask the questions a machine won’t: Why the extended drawdown? Is there something that changed in the broader macroeconomic environment? Was there a regime shift that requires a new gear to keep the account moving upward?
AI can write the code. It can explain the math. It can even tell you which parameters to tweak. But at the end of the day, when the market is open and the hard right edge of the chart is entirely blank, it’s just you and your edge.
Stay sharp. We’ll see you on the digital frontier.


