Urgent.News

650+ sources. One page. See who else covered it.

Editions

Tech

How to Catch a Pine Script Repaint Bug Before It Costs You Real Money

I've watched too many TradingView strategies look great in the Strategy Tester and then fall apart the moment real money went live. Almost every time, the code compiled fine. The bug wasn't syntax. It was repainting, the script quietly using information it shouldn't have had yet. Repainting doesn't throw an error. It just quietly makes your backtest better than your live trading will ever be.…

Repainting bugs in Pine Script can lead to inaccurate backtest results that don't accurately reflect live trading performance. To identify and address repainting bugs before they cost real money, there are four main sources to look out for:

1. Using request.security() with the wrong lookahead parameter. Pulling higher-timeframe values without proper handling can cause the current bar to leak into the calculation. The fix is to use barmerge.lookahead_off and offset the source by one bar, e.g. close[1]. Lookahead_on only works when the source has already been offset.

2. Computing entry signals before the bar closes. Entry logic running on close or ta.crossover() without a barstate.isconfirmed guard can result in signals appearing, disappearing, and reappearing as the forming close price changes. Guard all critical entry/exit logic with barstate.isconfirmed when evaluating intrabar.

3. Ambiguity between same-bar stop and target levels. When stop and target both could have been hit within the same bar's range, the Strategy Tester guesses which occurred first without always making the assumption clear. This hidden assumption can inflate win rates without being noticed.

4. Repainting can be manually tested using TradingView's Bar Replay tool. Step through history bar by bar to see if any signals that appeared in the past match your original observations. If a signal moves, vanishes, or appears retroactively as you replay forward, that's a clear sign of repainting.

A practical example demonstrated how cross-checking the Strategy Tester's results with an independent Python backtest agreed on the strategy's performance metrics. While manual cross-checking is time-consuming, automated tools like codemyedge generate Pine Script from plain English strategy descriptions and run them on real data to preview charts and catch repaints. Using such tools alongside manual verification is recommended before trusting any Strategy Tester numbers in live trading.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

My first project

What is it? My program uses python to run a basic card game that I like to play. The game is called Tongits and this is how it is played -> Rules The game can be played with 2-3 players.

  • Author's first Python project is a card game called Tongits
  • Game for 2-3 players with 12 cards each starting hand
  • Program enforces game rules through user inputs and loops

So…#WTH is State Machine Replication?

Every replicated database, Kafka partition, and Raft cluster relies on one rule: if deterministic replicas start identical and apply identical commands in an identical order, they stay identical.

Code Review From the Terminal and CI, No MCP Client Required

A month ago I shipped aicraft-code-review , an MCP server that reviews code locally. This week I added a CLI mode — because not everyone wants to wire up an MCP client just to check a diff.

  • Tool allows code review in terminal without MCP client
  • Three modes: Claude Code, Cursor, or CLI via mcp-code-review
  • Compatible with CI systems, outputs 0/1/2 exit codes

Four patterns that keep my YouTube longform JSON queue from going stale

I manage the YouTube longform queue for my BuilderStack channel as JSON files in content/yt-longform-queue/ . A spec file lands there when a generator script commits a new dialogue; the publish…

  • YouTube longform queue operates as a JSON file in content/yt-longform-queue directory
  • Explicit priority rank ensures product walkthroughs are published before recaps
  • 21-day stale expiry removes long-pending specs to maintain manageable queue

What the browser can actually tell you about your hardware (and what it can't)

I spent a while building browser-based hardware diagnostics and came away with a much clearer sense of where the web platform is genuinely capable and where it quietly lies to you.

  • Keyboard event.code and event.key differ in layout-dependency and physical position correspondence
  • Pointer events unify mouse, touch, and pen inputs, enabling multi-touch tracking and fault detection

More from Sunday 16 August →