Skip to content

Working with Existing Code

Use Existing Strategy or Existing Indicator when a complete Pine Script file already exists. Select Add source code, then paste the complete source or load a .pine file. The source is stored with the project separately from the conversation, allowing reviews, clarification answers and later modifications to use the same authoritative codebase.

The first file becomes the Current codebase. Use the ordinary message box for requests and questions after it has been saved. If you paste a complete Pine script into chat, Xen redirects it to the source window so it can be retained correctly.

Working on existing Pine Script with AI

Add supporting source

An existing-code project can contain up to four source files. Keep one authoritative current strategy or indicator, then add only the integration or reference files needed for the task. Integrate with current source tells Xen to bring relevant functionality into the current codebase. Use as reference only provides an example without making every feature a merge requirement. Replace current source changes which complete file is authoritative.

Attached files are labelled by role above the composer and can be removed when added accidentally. Xen will not review or modify the project until one current source exists.

Describe a focused change

Explain what currently happens and what should happen instead. State what must remain unchanged, especially inputs, plots, alert names and established strategy behaviour. When Pine Editor produced an error or warning, include the exact message and its line and column. When the script behaves incorrectly, include the symbol, timeframe, settings and bar state that exposed the issue.

If source is supplied without a requested change, Xen identifies the script and asks what you want to do rather than rewriting it automatically.

Review without changing code

After adding the current source, select Review strategy or Review indicator. Xen reviews all attached files, describes current behaviour, identifies defects or risks and lists decisions that still require clarification. This action does not generate replacement code. The report and subsequent decisions remain part of the project so they can inform a later modification.

For a focused analysis, ask a direct question in the composer and state that you want analysis only. When Xen later returns a complete revised script, that file becomes the latest working version. Compile it in Pine Editor and repeat the original test before requesting an unrelated feature.