> For the complete documentation index, see [llms.txt](https://docs.pinescriptstrategy.com/tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinescriptstrategy.com/tools/setup-instructions/connect-trading-signals-to-psstrategyx.md).

# Connect Trading Signals To PSStrategyX

### Here's an example of connecting a Signal Generator to the PSStrategyX tool.

Add another script to your chart by opening a new script in the pine editor and copying and pasting the code below, saving, and clicking "Add to chart".

```javascript
//@version=5
indicator(title="MA Cross Example", overlay=true, timeframe="", timeframe_gaps=true)
shortlen = input.int(9, "Short MA Length", minval=1)
longlen = input.int(21, "Long MA Length", minval=1)
short = ta.sma(close, shortlen)
long = ta.sma(close, longlen)
plot(short, color = #FF6D00, display = display.pane)
plot(long, color = #43A047, display = display.pane)
buy = ta.crossover(short, long)
sell = ta.crossunder(short, long)
signal = buy ? 1 : sell ? -1 : na
plotshape(buy, '', shape.labelup, location.belowbar, color.green, 0, 'BUY', color.black, display = display.pane)
plotshape(sell, '', shape.labeldown, location.abovebar, color.red, 0, 'SELL', color.black, display = display.pane)
plot(signal, 'Signal', display = display.data_window)
```

<figure><img src="/files/CBqLFTNi1m7mGZa0UTMe" alt=""><figcaption></figcaption></figure>

4. In the settings of the PSStrategyX, select the output of the other script as the source in the "source" dropdown.

<figure><img src="/files/jbRfyI1Riz9vWjXFR4Db" alt=""><figcaption><p>Go To the Settings of PSStrategyX</p></figcaption></figure>

<figure><img src="/files/yBdBDpakPql9vliG1smN" alt=""><figcaption></figcaption></figure>

Now you are ready to use the tool to analyze the chart and make trading decisions. The script will automatically update with the latest data as you move the chart, so you can see how your analysis changes over time.

### Where to go next?

If you want to set up the Broker Connecter to start live trading, head to the  next section --> [Set Up Autoview](/tools/setup-instructions/set-up-autoview.md)

If you're not ready to live trade because you want to do some backtesting you can head to want to ["Tips And Tricks"](/tools/tips-and-tricks/chart-aesthetics.md) and start tweaking your strategy until you are ready to test it live.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pinescriptstrategy.com/tools/setup-instructions/connect-trading-signals-to-psstrategyx.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
