‹ Quick answers

Answer · Pine Script checks

How do I check a Pine Script strategy for lookahead bias and repainting?

Look first at every request.security call: its lookahead parameter defaults to barmerge.lookahead_off, and TradingView's documentation says lookahead can let a higher-timeframe request return values from beyond the historical bar it runs on. Then check whether signals use the unfinished realtime bar, which can make a script repaint after the bar closes.

What the docs say

TradingView defines repainting as script behaviour causing historical versus realtime calculations or plots to behave differently. It adds that not all repainting is inherently useless or misleading.

For higher-timeframe requests, TradingView advises programmers to take extreme caution with lookahead.

Automatic and human checks

Our AIKIT code check reads Pine Script v5 and v6 as well as Python and MQL5, looks for 8 common mistakes including look-ahead, and returns exact fix lines. On a fresh set of 47 bots written by others it found 86.8% of planted mistakes with 3.3% of alerts false; on an earlier set 38% of alerts were false, so treat results as a guide.

Our human EA and Strategy Review includes look-ahead and repainting checks and Pine Script fixes on request.

Options

OptionWhat it isNotes
Read the TradingView docs and your codeThe docs explain lookahead and repainting; you search your own script for request.security and bar-state use.Free; needs you to know where to look.
AIKIT check_bot_codeAutomatic check of Pine v5/v6, Python and MQL5; 5 credits a check; exact fix lines.Free-beta trial key gives 25 credits; code is checked in memory and not stored.
EA + Strategy Review (person)Line-by-line read, look-ahead and repainting checks for AI-written code, a fee, spread and slippage check and an over-fitting score.Quick check US$39; US$149 small and US$299 large.

How to try it

  1. Search your script for request.security and check the lookahead argument.
  2. Check that signals are confirmed on a closed bar, not the realtime bar.
  3. For an automatic check get a trial key: curl -X POST https://api.tradingcheckup.com/v1/aikit/trial.

Questions people ask

Is repainting always a bug?

No. TradingView says not all repainting behaviour is inherently useless or misleading, but it can make historical results look better than live ones.

What is the default for lookahead?

barmerge.lookahead_off.

Can a code check tell me if the strategy will make money?

No. A code check is not a profit forecast, and a clean report does not mean an EA makes money.

Is my code kept?

The automatic check runs in memory and is not stored.

Related

Sources

Checked by Trading Checkup on 24 November 2026. Every number on this page comes from the sources listed above.

Want a person to look at your EA? Our quick EA check runs our code checker on one .mq4 or .mq5 file and a person adds a short summary within 2 working days, for a fixed US$39.

It does not consider your situation. Facts and examples do not promise future results. We do not recommend brokers, exchanges or firms.