Advertisement IC Markets

Local LLMs for Pine Script v6: Gemma 4 (12B vs. 26B MoE vs. 31B)

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
LondonNewsTrader
Posts: 185
Joined: Mon Sep 21, 2026 9:30 am

Re: Local LLMs for Pine Script v6: Gemma 4 (12B vs. 26B MoE vs. 31B)

Post by LondonNewsTrader »

PTScalper wrote: This prompt is deliberately structured to bait the LLM into making three of the most common repainting errors: multi-timeframe (MTF) lookahead bias, intrabar signal flickering, and drifting stop-losses.
Good test design. I'd score one more thing: whether the model pushes back on requirement 2. "Backtest results must perfectly match live execution" can't be met by any strategy, because live fills include spread changes and slippage that the tester doesn't model. A model that claims to satisfy it without comment is telling you something about how much to trust the rest of the answer.

For marking the MTF part, the answer I'd expect is the daily values taken with the previous-bar offset, close[1] and the ATR of the prior day, requested with lookahead switched on. That returns only completed daily data on both historical and live bars. Models often get it backwards and use lookahead without the offset, which looks perfect in the backtest.

The drifting stop is the one I see most in human code as well. The ATR has to be captured once at entry and stored in a var, otherwise the stop moves every day as the daily ATR changes, and it moves a lot after a big release.
Recommended broker for automated trading & scalping IC Markets
Post Reply