Practical tutorials

Backtest, inspect, and launch

Validate a saved app in simulation and check its launch configuration.

Use a saved app from your first SJS strategy or Pine signals to SJS orders, or a strategy you can explain from signal to execution. The goal is to reproduce behavior and confirm the runtime configuration, not infer future performance from one test.

For detailed data, warmup, fill, and comparison behavior, read the backtesting guides. The standalone SJS crossover provides a baseline without Pine or L3.

1. Choose the execution environment

Start with Stage Session (SSS) for a generic simulated session. For a broker-specific workflow, choose the corresponding app type and follow its configuration guide. For example, Polymarket SSS and Polymarket are different execution paths; see Configure Polymarket.

Select the instrument and interval. Confirm that historical data exists for that instrument and time range. Record those selections so a later run can reproduce them.

2. Save the app

Save PineScript, SJS, and any L3 or SQL/SQX configuration before testing. Confirm that only the intended layer places orders. Do not combine Pine strategy orders with an SJS arrow reader that submits the same entries.

3. Run a historical window

Use the app editor's historical run controls to choose the start and end of the test. Include enough bars to initialize the indicator and a period containing the signal you want to inspect.

In-memory historical sessions use that selected window rather than fetching the live session's external warmup. A longer lookback needs more data at the start of the window.

AI provider calls are disabled during backtesting and historical warmup, including calls using your own API key. This prevents a historical bar loop from sending repeated requests to your provider. Test AI behavior in a running session; deterministic fake-provider responses remain available for testing strategy logic.

4. Inspect more than P&L

Check the session chart, Trades, and Logs together:

  1. Find a signal on the chart.
  2. Confirm that the strategy attempted the expected entry or exit.
  3. Inspect the resulting fill and position state.
  4. Check for duplicate orders, stale arrows, and errors.
  5. Repeat the same saved configuration and window to compare behavior.

For the tutorial, a Sell arrow should close a long position rather than create a short. If that fails, fix the strategy before changing execution environments.

5. Configure a running session

Open Run an app from the saved app. Review the launch target and the broker selection offered for that app type. The launch form's available brokers depend on compatibility with the selected type.

Check the instrument, interval, and warmup setting. Pine live sessions default to one hour of warmup; the launch form exposes a warmup toggle and duration selector. A running simulated session and a live broker session can receive different data and fill differently.

Select Run App only after the displayed execution mode and broker match your intended environment.

6. Verify startup

Wait for the session to reach RUNNING. Check incoming chart data, logs, positions, and the first relevant signal. A running process alone does not prove that the broker has accepted orders.

If the configuration is wrong, stop the session before changing it. Confirm broker-side orders and positions separately: stopping a process is not the same as closing a position.

Troubleshooting

SymptomCheck
No historical barsInstrument identity, data availability, and selected time range
Indicator initializes lateLookback length and available bars
Broker missing from launchApp type and broker compatibility
Session runs but orders failLogs, broker connection, instrument configuration, and execution mode
Live results differ from simulationMarket data, warmup, open-bar updates, latency, and fills

Completion checks

Retain the reviewed source revision and historical run, verify the saved app, and confirm the launched server's runtime/account and fresh input. Expected outcome is an explainable test plus a separately verified running session, not automatic promotion of historical results into live account state.

Common mistakes are launching unsaved source, using the wrong broker environment, assuming restart preserves custom state, or treating stop as a position close. Follow launching, monitoring, and stopping and restarting for those controls.

On this page