Skip to content

Pine studies fail with "Can't parse pine": pine-facade translate no longer returns ilTemplate #354

Closed as not planned

Description

@botbeech

Since 2026-10-27 (between ~08:00 and ~12:00 UTC), pine-facade/translate no longer returns result.ilTemplate. Every Pine study built from it is created with no script, and the chart server answers study_error "Can't parse pine". This affects built-in (STD;RSI), public and private (USER;…) scripts alike.

Where the compiled script went: it is now sent only as the defval of the hidden text input (name: "ILScript") in result.metaInfo.inputs. The value starts with the usual bmI9Ks46_ prefix. pineId and pineVersion still come with an empty defval.

curl -s 'https://pine-facade.tradingview.com/pine-facade/translate/STD%3BRSI/last' \
  | jq '{keys: (.result | keys), text: (.result.metaInfo.inputs[] | select(.id == "text") | .defval[0:20])}'
# {"keys": ["metaInfo"], "text": "bmI9Ks46_..."}

Affected code: parseIndicatorDefinition in the npm 4.x builds (dist/http/indicators.js, script: result.ilTemplate), and getIndicator in src/miscRequests.js on main (script: data.result.ilTemplate). parseInputs skips the text input, so PineIndicator.toStudyInputs() sends text: undefined. This happens on 4.0.0, 4.0.1 and 4.1.0.

Workaround we use: take the script from result.ilTemplate when it is present, else from the text input's defval, and pass that as ilTemplate to parseIndicatorDefinition:

function scriptFromTranslate(result) {
  if (result.ilTemplate) return result.ilTemplate;
  const text = result.metaInfo.inputs?.find((input) => input.id === 'text')?.defval;
  if (typeof text === 'string' && text) return text;
  throw new Error('no compiled script: neither result.ilTemplate nor the "text" input defval');
}
const indicator = parseIndicatorDefinition({ ...result, ilTemplate: scriptFromTranslate(result) }, id, version);

With this change, studies work again for STD;RSI, private scripts and strategies (backtest reports).

Activity

  1. jasongrig commented on Oct 27, 2026

    @jasongrig

    I had the same issue and the workaround is in the right direction.

  2. added a commit that references this issue on Oct 30, 2026
    acb37c5
  3. Mathieu2301 commented on Oct 30, 2026

    @Mathieu2301
    Owner

    Update: TradingView moved the compiled script again. Since about 30 Oct 2026, the text input's defval is empty and the script lives in result.metaInfo.defaults.inputs.text, so the workaround above stopped working.

    Fixed in #355, published as 4.1.1-beta.0 (npm i @mathieuc/tradingview@beta). It reads all three locations (ilTemplate, the text input, metaInfo.defaults.inputs.text). Verified live with an authenticated session: STD;RSI and a private USER;… indicator return data again.

    On 3.x (src/miscRequests.js, getIndicator), the equivalent patch is:

    const r = data.result;
    const text = r.metaInfo.inputs?.find((i) => i.id === 'text')?.defval;
    const script = r.ilTemplate || (text && text.startsWith('bmI9Ks46_') ? text : null)
      || r.metaInfo.defaults?.inputs?.text;
    // ...then use `script` where `data.result.ilTemplate` was used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions