Investigate an unexpected trade
Trace one outcome backward through requests, decisions, state, and data.
Prerequisites
Choose one completed historical run or a captured running-session event. Retain its saved revision, server/run identity, instrument, and execution environment. Use existing evidence before changing source.
Anchor the investigation
Select the unexpected trade and record its side, quantity, price, time, and order identity when available. Confirm that you selected the intended app or follower and the correct run.
Do not assume a chart marker's display time is the signal-production time or request time. For the Pine tutorial, signal time and consuming-frame time intentionally differ.
Work backward
- Find the request associated with the outcome. Check source, metadata, and requested quantity.
- Find the originating decision. Compare its recorded signal to the source revision that ran.
- Inspect pending orders and position state used by the decision. A previous accepted request may not yet have filled.
- Check the input bar, timestamp, warmup, and relevant indicator values.
- Inspect automation mode, L3 checks, and the selected simulator or broker behavior.
Expected outcome: an explanation of the first stage that differed from your intended behavior, not merely a changed strategy that hides the symptom.
Reproduce the first divergence
For a historical case, rerun the smallest window that still includes required initialization history. Keep execution settings fixed. Add a compact diagnostic record only for the evidence you are missing, then save a new revision.
For a broker case, distinguish request acceptance, fills, and account updates. Historical replay may reproduce the decision without reproducing the broker outcome.
Common findings
| Observation | Likely next check |
|---|---|
| Two entry attempts for one event | Multiple execution owners, repeated callbacks, or process-state reset |
| Exit signal with no close request | Pending orders, wrong position side, or consumed event policy |
| Approved request without a trade | Eligibility, delay, price conditions, or broker rejection |
| Trade appears after stopping | Outstanding broker order or delayed account update |
| Different result after restart | New runtime state, initialization, account state, or a different saved source |
Do not treat stored server results as a live account reconciliation. Verify remaining orders and positions through the appropriate account path.