Connect your strategy
Use your script’s existing alerts to connect its trading instructions to your verified demo setup.
With your demo setup verified, connect your own indicator or strategy. This default path uses alerts the script already provides; you do not need to edit its source.
Add the script to your chosen TradingView chart before checking its alert options. Open Create alert with Alt+A on Windows or Option+A on Mac.
If you need to change the script’s code, take the optional Low-code guide instead. If you arrived here first, complete Test your setup before creating strategy alerts.
Find your available alert method
Section titled “Find your available alert method”| What you can select or edit | Follow this setup |
|---|---|
| Order fills only in a strategy’s alert options | Strategy order-fill alerts |
| A script’s Inputs include PineConnector messages or a License ID, and its author supports PineConnector | A PineConnector-ready script |
| Named indicator conditions such as Buy, Sell, Going Long or Going Short | Separate buy and sell conditions |
Test 1: check the strategy’s alert menu
Section titled “Test 1: check the strategy’s alert menu”Open Create alert and select your script under Condition. If Order fills only is available, it can generate events when TradingView’s broker emulator fills the strategy’s simulated orders.
EnlargeThis makes alerts available; it does not establish that the strategy’s entries, exits and sizing map correctly to PineConnector. Read the limitation in the strategy setup before connecting it.
Test 2: check the script’s inputs
Section titled “Test 2: check the script’s inputs”Open the script’s Settings → Inputs. Look for fields such as License ID, Symbol, Long alert message, or Short alert message. Confirm with the author that they produce PineConnector-compatible messages.
EnlargeA field called License ID alone is not proof of compatibility. If the author has not exposed usable messages, continue to the next test.
Test 3: check for named conditions
Section titled “Test 3: check for named conditions”Open Create alert, select the indicator, then open its condition list. Look for separate entry conditions named by its author. Generic comparisons such as Crossing alone are not the same as a dedicated Buy or Sell condition.
See an example of named conditions
EnlargeIf none of these options is available
Section titled “If none of these options is available”Ask the script author to add alert support or PineConnector compatibility. The author can use the Pine Script alert instructions without publishing their private strategy logic. A picture of an entry on the chart cannot, by itself, create an alert.
Strategy order-fill alerts
Section titled “Strategy order-fill alerts”- Select your strategy, symbol and timeframe in Create alert.
- Choose Order fills only.
- Choose a message that matches the strategy’s intended order handling.
- Add the webhook URL, then create the alert.
For a workflow where every fill is intentionally a buy or sell entry request, this template uses the simulated order’s direction and the alert’s ticker. The risk=1 value still follows the EA’s Volume Type.
If the script’s own instructions use {{strategy.order.alert_message}}, follow those instructions instead. That placeholder reads messages explicitly supplied by the script author.
Can I use the strategy’s quantity as risk?
The old guide shows risk={{strategy.order.contracts}}. That quantity belongs to TradingView’s simulated order. It is not automatically MetaTrader lots, cash risk or a percentage. Only map it after checking units, instrument contract sizes, reversal quantities and the EA’s Volume Type.
A PineConnector-ready script
Section titled “A PineConnector-ready script”- Open the script’s Settings → Inputs.
- Enter your License ID, broker symbol and any message/risk/stop settings provided by its author. Save the inputs.
- Create an alert for the desired symbol and timeframe.
- Select the script and the option for Any alert() function call or alert() function calls only, as available.
- Add the webhook below and create the alert.
The script builds the message in this method. Do not add a second message template or enable additional event types unless the author’s instructions require it. Inspect the first triggered message to check the values it actually sends.
Separate buy and sell conditions
Section titled “Separate buy and sell conditions”Create two alerts for the same symbol and timeframe: one for the Buy/Long condition, another for the Sell/Short condition.
- Select the indicator and its Buy or Going Long condition.
- Set the trigger to Once Per Bar Close for this guide’s example.
- Paste the buy message below, with your exact broker symbol and chosen
risk=value. - Add the webhook and create the alert.
- Repeat using the Sell or Going Short condition and the sell message.
These examples use EURUSD. Replace it if your broker uses a different name or suffix. risk=1 follows your EA’s Volume Type; add any stop-loss parameters your sizing method requires.
For a message that also sets stop loss and take profit, the source guide provides this form. It assumes Target Type = Pips, Volume Type = Lots, and Setting = Signal Parameters Only. Replace the lot size and target distances before testing.
Use {{ticker}} in place of EURUSD only when TradingView’s ticker matches your broker’s symbol. These indicator conditions do not provide strategy order placeholders such as {{strategy.order.action}}.
Useful placeholders
Section titled “Useful placeholders”| Placeholder | Meaning | Use in |
|---|---|---|
{{ticker}} |
The alert’s ticker | Supported TradingView alert message fields |
{{strategy.order.action}} |
The simulated fill’s buy/sell direction | Strategy order-fill alerts |
{{strategy.order.contracts}} |
The simulated order’s quantity | Strategy order-fill alerts; conversion needs review |
{{strategy.position_size}} |
The strategy’s signed position size | Strategy alerts, not broker account state |
{{strategy.market_position_size}} |
The strategy’s absolute position size | Strategy alerts, not broker account state |
See TradingView’s alert reference for how each alert method works. Placeholders in the alert dialog are different from Pine Script expressions used inside alert(...).
Add the webhook and check the result
Section titled “Add the webhook and check the result”Enable Webhook URL in the alert’s notification settings and paste:
TradingView requires two-factor authentication for webhooks. If the webhook option is unavailable, check your TradingView account settings and feature access.
Wait for a real-time condition on your demo setup, then compare:
| Check | What to confirm |
|---|---|
| TradingView Alerts log | Direction, License ID, final symbol and parameter values are correct. No unresolved placeholders remain. |
| PineConnector Signals log | The same message arrived and its processing result is visible. |
| MetaTrader | The intended account has the expected direction, volume and stops, with no duplicate or unintended reverse trade. |
A received alert is not proof of a broker fill. Use Missing signals to find where the path stopped, or Errors when a processing error is shown.
If the message or resulting trade is wrong, pause the alert in TradingView’s Alerts panel before changing and testing it again. For these single-chart methods, create a separate alert for each symbol and timeframe you want to automate, and verify each destination.
Ready to continue: you have checked the strategy’s intended entries and exits on demo, including the account, symbol, trade size and any stops. Remove test alerts that could duplicate your strategy’s requests.
Try a guided example
Section titled “Try a guided example”The Logistic Regression walkthrough uses named Buy and Sell conditions. The SuperTrend walkthrough uses messages generated by Pine Script.
