Home/Documentation

Documentation

Using PineScript API in ChatGPT.

Learn how to request a compatible Pine Script v6 backtest from ChatGPT, resolve settings and data, follow job status, and review an auditable result.

Quick start

CHATGPT REQUIREMENT

Use ChatGPT Plus or higher. Select the newest model available for stronger Pine Script reasoning and backtest analysis.

  1. 1

    Open PineScript API in ChatGPT

    Start a conversation with the public GPT action.

  2. 2

    Describe an idea or paste Pine Script v6

    Start in plain English, or bring an existing strategy() script whose logic should be preserved.

  3. 3

    Specify the experiment

    Provide market, timeframe, dates, capital, commission, slippage, and any input overrides.

  4. 4

    Review compatibility and results

    Resolve unsupported features, then inspect risk, trade history, and the recorded execution settings.

Recommended request format

Backtest the Pine Script v6 strategy below.

Exchange and symbol: [EXCHANGE:SYMBOL]
Timeframe: [D / 3h]
Period: [YYYY-MM-DD] to [YYYY-MM-DD]
Initial capital: [amount]
Commission: [type and value]
Slippage: [ticks]
Input overrides: [name=value]
Requested output: [summary / risk / trades]

[PASTE strategy() SCRIPT]

Minimum information for a repeatable run

  • Exact strategy source and Pine Script version
  • Exchange, symbol, timeframe, and test dates
  • Initial capital, commission, and slippage
  • All input values that differ from the script defaults
  • Engine build, dataset ID and loaded coverage, script SHA-256, settings SHA-256, and request fingerprint

Public default settings

When a request omits a setting, the result should show the final resolved value actually used by the engine.

DatasetCRYPTO:BTCUSD
Exchange / symbolCRYPTO / BTCUSD
Timeframe3h
Initial capital100000
Commission0.1%
Slippage0 ticks
Pyramiding0
Date rangeFull loaded period
Process on closefalse
Calculate after fillsfalse
Calculate on every tickfalse
Bar Magnifierfalse
Standard OHLC fillsfalse
Backendfast_path

Script properties and resolved settings

Every result should show both the properties declared in the Pine script and the final resolved execution settings. The resolved settings are the values actually used by the engine. If a requested value conflicts with a script declaration, verify the final resolved value on the run receipt rather than assuming which one won.

Asynchronous job flow

01Queued

The request has a job ID and is waiting for execution capacity.

02Running

The engine is compiling, validating, and executing the strategy.

03Succeeded or failed

Poll the job ID until a result or a specific error is returned.

Optimization uses a separate job and may contain child runs. Completed trade history is retrieved with cursor-based pagination; do not assume a CSV download unless a file is explicitly returned.

Dataset states

FreshRun with current managed data
Stale · refresh queuedExisting result remains usable with a freshness warning
Fetch queuedNo backtest result yet; poll or retry after the dataset is ready
UnavailableResolve another exact dataset or stop the request

Trade window and warm-up

The date range controls when new entries are allowed; it does not truncate indicator history. Earlier bars may be used for warm-up, and an open position may be force-closed immediately after the trade window ends. If no dates are supplied, the full loaded period is used.

Account and run usage

ChatGPT access

ChatGPT Plus or higher is required. Use the newest model available for the strongest reasoning.

API connection

The first backtest may ask you to connect your PineScript API account through ChatGPT.

Trial credit

Available PineScript API trial credit can permit a run without a separate active API subscription.

Backtest

One submitted backtest consumes one run.

Optimization

Each submitted input variant consumes one run, with up to 30 variants per request subject to available credits.

Reading the result

Return

Read net profit beside the capital base and backtest period.

Risk

Use maximum drawdown to understand the decline experienced along the way.

Sample

Check the number of trades and whether a few outliers dominate performance.

Costs

Compare gross behavior with commission and slippage included.

Preserve the strategy before forcing compatibility

Do not remove an unsupported feature merely to force the strategy to run if that feature changes the original trading idea. Use the compatibility explanation to simplify the model deliberately or test it in another environment that supports the required behavior.

Run the workflow

Test the script with its assumptions attached.

Bring the Pine Script, market, timeframe, costs, and date range into one GPT conversation.

Open PineScript API