> For the complete documentation index, see [llms.txt](https://docs.tradesurge.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tradesurge.co/platform/strategies/upload-pine.md).

# Upload a Pine Script strategy

Upload a TradingView Pine Script strategy. TradeSurge translates the supported subset into the Strategy API and labels how faithful the translation is.

If your strategy already lives on TradingView, you can upload its Pine Script. TradeSurge translates it into the Strategy API so it can be backtested like any other strategy. Only a safe, non-repainting subset of Pine is accepted.

{% hint style="info" %}
**Coming soon.** Pine upload is not open yet. Python strategies come first.
{% endhint %}

## What you need

* A Pine Script that declares `//@version=5`.
* One `strategy()` or `indicator()` declaration.
* Entries and exits written with `strategy.entry` and `strategy.close`.

## Upload it

{% stepper %}
{% step %}

### Paste or upload the script

Open Strategies and choose Pine Script.
{% endstep %}

{% step %}

### Read the validation result

TradeSurge checks every construct in your script. Anything unsupported is rejected with a plain reason.
{% endstep %}

{% step %}

### Check the confidence label

A translated strategy carries a confidence label. It tells you whether every construct translated exactly, or whether some were approximated.
{% endstep %}

{% step %}

### Backtest the translated version

Run a backtest to confirm the translation behaves as you expect.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
The most common rejection is repainting. Constructs that can change past signals, such as higher-timeframe requests or intrabar calculations, backtest well but do not predict live results, so they are refused.
{% endhint %}

## What is supported

| Name             | What it means                                                                                                  |
| ---------------- | -------------------------------------------------------------------------------------------------------------- |
| **Price series** | `open`, `high`, `low`, `close`, `volume` and back-references like `close[1]`.                                  |
| **Indicators**   | `ta.sma`, `ta.highest`, `ta.lowest`, crossovers exactly; `ta.ema` and `ta.rsi` approximated on the first bars. |
| **Inputs**       | `input.int`, `input.float`, `input.bool`, which become tunable parameters.                                     |
| **Orders**       | `strategy.entry` and `strategy.close` at candle close.                                                         |
| **Logic**        | Arithmetic, comparisons, `and`, `or`, `not`, `?:` and `if` blocks around orders.                               |

## Good to know

* Single timeframe only.
* Each variable can be assigned once.
* `plot` is accepted but ignored for trading.

## Next steps

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Backtest a strategy</strong></td><td>Check the translation against history.</td><td><a href="/platform/strategies/backtest.md">Backtest a strategy</a></td></tr><tr><td><strong>Upload a Python strategy</strong></td><td>Full control with the Strategy API.</td><td><a href="/platform/strategies/upload-python.md">Upload a Python strategy</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tradesurge.co/platform/strategies/upload-pine.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
