TradingView backtesting diagnosis

TradingView Strategy Tester No Data: Find the Missing Trade

TradingView Strategy Tester "No data" usually means the selected strategy has no simulated trades to report. Check that you added a strategy with order commands, resolve runtime errors, then trace entry conditions, order size and capital through the tested period. A buy arrow drawn by a script is not proof of an order fill. Check the selected strategy and report dates before changing code.

Review Strategy Code with AI

1. Confirm the script and the selected report

Open the strategy report, also known as Strategy Tester, and check which script is selected. Current TradingView documentation uses Metrics and Trades for its report tabs; older help articles refer to Overview and List of Trades. Inspect the trade list regardless of the label in your interface. If multiple strategies are on the chart, select the one you are debugging.

  • Check the declaration in Pine Editor. indicator() and library() scripts do not produce strategy reports.
  • Find the entry order command. Changing indicator() to strategy() alone does not turn plotted buy/sell signals into trades.
  • Read any red exclamation mark beside the script name. A runtime error stops calculations; fix the reported problem before adjusting signals.

2. Trace the signal, order request and fill

Start at the earliest missing event in this table. Change one setting at a time and record the symbol, timeframe, inputs and strategy Properties so that the result can be repeated.

ObservationNext checkWhat the result tells you
No entry condition markersPlot the raw signal, each filter and the final combined condition.A filter may exclude every signal, or the input series may be unavailable.
Signal markers but no entry callsInspect surrounding if blocks, position checks, date/session gates and early branches.The displayed signal may differ from the condition that reaches the order command.
Entry calls but no filled tradesCheck quantity, margin, capital, risk rules, pyramiding and pending order prices.Calling strategy.entry() does not prove that a new position was opened.
An open trade but no closed tradesInspect the exit condition and matching entry ID.The entry worked. Diagnose exits rather than treating the run as having no orders.
Trades exist outside the report periodCompare report dates, script date inputs and available history.The report may be examining a different period from the chart markers.

3. Check quantity, capital and futures point value

For a same-currency estimate, position notional is price × quantity × syminfo.pointvalue. Required margin is that notional multiplied by the margin percentage. For an illustrative futures price of 4,000, point value of 50 and quantity of one, notional is 200,000. At 100% margin, a 10,000 account cannot fund that position. Account currency conversion and trading costs can also matter; this arithmetic is a diagnostic estimate, not a complete execution model.

  • Inspect both Properties and source code. An explicit non-na qty in strategy.entry() overrides the default order size, so changing Properties alone may have no effect.
  • Use a positive quantity that respects the symbol's minimum tradable size. Zero quantity creates no trade; a negative quantity can cause a runtime error. Inspect calculated quantities before rounding and after rounding.
  • Percentage-of-equity sizing is not a universal fix. A small allocation may still be too small for a tradable unit, and an explicit qty bypasses that default.
  • Pine v6 defaults margin_long and margin_short to 100%; v5 used 0%. A migrated strategy can therefore stop opening positions that previously ignored available funds. Set assumptions explicitly and inspect saved Properties.
  • For diagnosis, try an affordable size or a larger simulated capital balance. Do not lower margin merely to make an unrealistic backtest produce trades.

4. Inspect data, dates and unfilled price orders

Check the actual values used by the entry rule. A lookback calculation or requested series can be na on some bars. In Pine v6, bool values are true or false, but comparisons involving unavailable numeric inputs can still prevent an entry condition from becoming true. Plot the numeric inputs and guard them with not na(...) where the rule requires valid data.

  • Compare the script's start/end inputs with loaded history. Check that start precedes end, the timestamp timezone is intentional, and any session filter admits bars on this symbol.
  • Keep report date controls separate from code filters. Deep Backtesting can use a different dataset from the chart, so chart markers alone do not establish what happened in that report.
  • Inspect limit and stop prices. An entry order can remain pending if price never reaches its activation or fill level. Check cancellations and repeated orders using the same ID.
  • A market order created on a historical bar normally fills on the next available tick, often the following bar's open. A signal on the final bar may have no later tick available in the tested data.
  • For zero closed trades, inspect strategy.position_size and strategy.opentrades. strategy.close() uses an entry ID; strategy.exit() associates an exit with an entry through from_entry. A mismatched ID can leave a position open.

5. Run a separate Pine v6 diagnostic strategy

Paste this complete script into a new strategy. It counts eligible bars, raw SMA crosses and calls to strategy.entry(), then shows open and closed trades separately. The diagnostic market-order mode bypasses the SMA signal and requests an entry every 20 bars, followed by a close five bars later. It is an isolation test, not a trading system. Use at least 30 loaded bars and enough simulated capital for one tradable unit; neither mode guarantees a fill on every symbol.

  • Eligible bars = 0: inspect the date filter and data range before changing the entry rule.
  • Raw crosses > 0 but entry calls = 0 in normal mode: check whether those crosses occurred inside the date range while the strategy was flat.
  • Entry calls > 0 but open and closed trades both = 0: inspect quantity, available capital and the existence of a later fill tick. The counter is not an order rejection log.
  • Diagnostic mode fills but normal mode does not: compare the SMA signals and gates in this dataset. This isolates a difference in the example; it does not prove every feature of your original script or account works.
Complete Pine Script v6 diagnostic strategy. Entry-call counts measure code execution, not accepted or filled orders.pinescript
//@version=6
strategy("No data diagnostic", overlay = true, initial_capital = 100000,
     margin_long = 100, margin_short = 100, pyramiding = 0)

bool testMode = input.bool(false, "Diagnostic market-order mode")
float orderQty = input.float(1.0, "Quantity (tradable units)", minval = 0.000001)
bool useDates = input.bool(false, "Enable date filter")
int startTime = input.time(timestamp("01 Jan 2024 00:00 +0000"), "Start")
int endTime = input.time(timestamp("31 Dec 2030 23:59 +0000"), "End")
bool inRange = not useDates or (time >= startTime and time <= endTime)

float fast = ta.sma(close, 9)
float slow = ta.sma(close, 21)
bool ready = not na(fast) and not na(slow)
bool crossedUp = ta.crossover(fast, slow)
bool crossedDown = ta.crossunder(fast, slow)
bool entrySignal = testMode ? bar_index % 20 == 10 : ready and crossedUp
bool exitSignal = testMode ? bar_index % 20 == 15 : crossedDown
bool entryCall = inRange and entrySignal and strategy.position_size == 0

var int eligibleBars = 0
var int rawSignals = 0
var int entryCalls = 0
if inRange
    eligibleBars += 1
if crossedUp
    rawSignals += 1
if entryCall
    entryCalls += 1
    strategy.entry("Long", strategy.long, qty = orderQty)
if (exitSignal or not inRange) and strategy.position_size > 0
    strategy.close("Long")

plot(fast, "Fast SMA", color.blue)
plot(slow, "Slow SMA", color.orange)
plotshape(crossedUp, title = "Raw SMA cross", style = shape.circle,
     location = location.abovebar, color = color.blue, text = "S")
plotshape(entryCall, title = "Entry command called", style = shape.triangleup,
     location = location.belowbar, color = color.green, text = "E")
plot(close * orderQty * syminfo.pointvalue, "Estimated notional in symbol currency",
     display = display.data_window)

var table report = table.new(position.top_right, 2, 6,
     bgcolor = color.white, border_width = 1)
if barstate.isconfirmed
    table.cell(report, 0, 0, "Diagnostic", text_color = color.black)
    table.cell(report, 1, 0, "Count", text_color = color.black)
    table.cell(report, 0, 1, "Eligible bars", text_color = color.black)
    table.cell(report, 1, 1, str.tostring(eligibleBars), text_color = color.black)
    table.cell(report, 0, 2, "Raw SMA crosses", text_color = color.black)
    table.cell(report, 1, 2, str.tostring(rawSignals), text_color = color.black)
    table.cell(report, 0, 3, "Entry calls", text_color = color.black)
    table.cell(report, 1, 3, str.tostring(entryCalls), text_color = color.black)
    table.cell(report, 0, 4, "Open trades", text_color = color.black)
    table.cell(report, 1, 4, str.tostring(strategy.opentrades), text_color = color.black)
    table.cell(report, 0, 5, "Closed trades", text_color = color.black)
    table.cell(report, 1, 5, str.tostring(strategy.closedtrades), text_color = color.black)

6. Restore the original rules one at a time

After the isolated strategy produces a trade, return to a copy of the original script. Add counters around its actual entry call, restore the signal, then restore date/session filters, sizing and price orders separately. Preserve the original strategy Properties and record each change. If a small reproducible example still fails, include its source, symbol, timeframe, dates, Properties and exact runtime message when asking the script author or TradingView support for help.

Where Pineify fits

Pine Script AI Coding Agent

Bring the script, chart symbol, timeframe, Properties and diagnostic counts to Pineify's AI Coding Agent to review the order logic and draft a fix. Validate the revised strategy on TradingView with the same settings.

Review Strategy Code with AI

Frequently asked questions

Educational programming guidance, not investment advice. The example is a diagnostic aid, not a trading recommendation. A successful syntax check does not establish that orders will fill on your chart or that a strategy is profitable.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.