Troubleshooting

When Strategy Lab refuses to trade, goes quiet, or produces something different than you expected, start with the boring evidence. The diagnostics table, state tokens, and position tokens usually tell the story before...

Written By Axiom Admin

Last updated 1 day ago

Troubleshooting

When Strategy Lab refuses to trade, goes quiet, or produces something different than you expected, start with the boring evidence. The diagnostics table, state tokens, and position tokens usually tell the story before the trade list does.


First Check: Status

Status

What it means

What to do

Strategy Inactive

A blocking error or required safety setting is preventing trading.

Fix the first ERROR in the diagnostics table.

Strategy Active with Warns

The strategy can trade, but warnings were recorded.

Read the warnings before trusting the result. They often explain quiet rules or warmup behavior.

Strategy Active

No blocking diagnostics were retained.

Debug the rule chain, state tokens, and order assumptions.

For code-level meanings, use Diagnostics & Error Codes.


Strategy Inactive

This means the engine is not allowed to trade. Common causes:

Cause

What you will see

Fix

Consent/safety setting not enabled

Strategy status says inactive even before YAML issues matter

Enable the required setting after reading it.

Missing required YAML field

YAML_MISSING_REQUIRED_FIELD

Add the field named in the diagnostic.

YAML field was removed

YAML_REMOVED_FIELD

Use the latest YAML specification from the documentation.

Unknown token

EXPR_UNKNOWN_TOKEN or TOKEN_UNKNOWN

Fix spelling or connect the custom token.

Bad expression type

EXPR_FINAL_TYPE

Make boolean fields end in true/false and price fields end in numbers.

Invalid order price

YAML_ORDER_PRICE_REQUIRED or expression diagnostics on a price field

Add or repair the required price expression.

Fix the first blocking diagnostic first. Later errors may be side effects.


Active With Warnings

Warnings do not stop the strategy, but they are not decoration. They usually mean one of these:

Warning pattern

What it means

Historical value unavailable

A lookback like PRICE_CLOSE[5] does not exist on this bar.

Function input is NaN

A function received a missing or unusable value.

Division or percent base invalid

A denominator/base value was zero or unavailable.

Unknown YAML field

The parser saw a field it does not use.

OCA type without group

entry_oca_type has no group to act on.

Cancel has no effect

A market exit has cancel logic, but market exits do not sit as working orders.

If the warning is expected during early warmup, you may be fine. If it appears deep into the chart, fix it.


No Trades

Work the chain from outside to inside:

  1. Is the strategy status active?

  2. Is the direction enabled?

  3. Does the setup reach _ACTIVE or its shorthand alias ACT?

  4. Is the entry gate true?

  5. Is the entry trigger true?

  6. Has the entry already fired under entry_one_shot?

  7. Did the setup hit setup_max_entries_per_activation?

  8. Is a risk brake blocking new entries?

  9. If it is a limit/stop entry, did price actually reach the order?

  10. Did the order expire or cancel while still working?

The quickest test is to simplify:

Example
entry_trigger_when: PRICE_CLOSE > 0 entry_order_type: MARKET entry_allocation_percent: 100

If that trades, the engine is alive. Add the real conditions back one at a time.


Entry Orders Appear But Do Not Fill

This usually means the order is working, not filled.

Check:

Question

Where to look

Shorthand alias

Is the entry still confirming?

<ENTRY_NAME>_CONFIRMING

<ENTRY_NAME>CONF

Is the entry unit working?

<ENTRY_NAME>_WORKING

<ENTRY_NAME>WORK

Is the entry already active?

<ENTRY_NAME>_ACTIVE

<ENTRY_NAME>ACT

Did the limit/stop price land where you expected?

entry_limit_price / entry_stop_price diagnostics

Is the order expiring too quickly?

entry_expire_after_bars

Is cancel logic killing it?

entry_cancel_when

Is OCA canceling sibling orders?

entry_oca_group, entry_oca_type

Remember that TradingView's broker emulator has its own fill assumptions. A limit order that looked close on the chart may still not fill depending on bar sequence, magnifier settings, and price path.


Exits Do Not Fire

Start with position state:

Example
POSITION_ACTIVE POSITION_REMAINING_QUANTITY POSITION_REMAINING_PERCENT POSITION_AVERAGE_PRICE

Then check the exit unit:

Question

Where to look

Is the exit gate true?

take_profit_gate_condition or stop_loss_gate_condition

Is the trigger true?

take_profit_trigger_when or stop_loss_trigger_when

Is the exit still confirming?

<EXIT_NAME>_CONFIRMING or <EXIT_NAME>CONF

Is the exit working?

<EXIT_NAME>_WORKING or <EXIT_NAME>WORK

Is the price valid?

Limit/stop price diagnostics

Is allocation creating a nonzero quantity?

*_allocation_percent and remaining position

Multiple exits can each be set to 100% when they are alternative full exits. That is valid. If you expected a leg, make the allocation smaller and use POSITION_REMAINING_PERCENT to control what comes next.


Break-Even Stop Does Not Activate

The most reliable gate is usually remaining position:

Example
stop_loss_gate_condition: POSITION_ACTIVE && POSITION_REMAINING_PERCENT <= 50 stop_loss_trigger_when: TRUE

If the stop never activates, check whether the partial take profit actually filled. A trigger being true is not the same as a fill. POSITION_REMAINING_PERCENT is the stronger evidence.


Expression Warns On Historical Values

A lookback token like PRICE_CLOSE[5] needs five previous bars. Early in the chart, that value is not there.

If you want the expression to stay quiet during warmup, use a fallback:

Example
entry_trigger_when: SAFE_DIV( PRICE_CLOSE - NZ(PRICE_CLOSE[5], PRICE_CLOSE), NZ(PRICE_CLOSE[5], PRICE_CLOSE), 0 ) > 0.01

Logical guards are useful, but do not rely on them as your only protection around unsafe function inputs.


Custom Tokens Look Correct But Rules Stay False

Check three things:

  1. The token name is spelled exactly the same in the Inputs tab and YAML.

  2. The token type matches the value: Number or True/False.

  3. The source plot is actually moving and not stuck at zero or NaN.

A token can exist and still feed bad data. The diagnostics will catch missing names; they cannot know whether you connected the wrong plot unless the values become unusable.


Results Changed After Reload

Common causes:

Cause

Why it changes

TIME_NOW

Uses current wall-clock time during recalculation.

Real-time bar-state tokens

Historical bars and live bars do not behave the same.

External indicator repainting

Custom token values can change if the source indicator repaints.

TradingView settings changed

Bar magnifier, commission, slippage, pyramiding, or order-size settings changed.

Data vendor/history changed

TradingView may revise or extend historical data.

Backtests are simulations. If a result matters, re-run it across reloads, dates, and market conditions.


The Smallest Useful Debug Loop

  1. Fix blocking diagnostics.

  2. Decide whether warnings are expected or real problems.

  3. Watch setup state tokens.

  4. Watch entry/exit _CONFIRMING, _WORKING, and _ACTIVE tokens, or the matching CONF, WORK, and ACT aliases.

  5. Watch position tokens.

  6. Simplify the YAML until it trades.

  7. Add complexity back one rule at a time.

There is no shame in making the strategy intentionally simple for five minutes. A simple strategy that trades tells you the machine is alive. Then you can find the exact rule that made it go quiet.