How to Connect TradingView Strategies with Tradetron

Huzefa Kudrati Updated Oct 6, 2026 9 min read

How to Connect TradingView Strategies with Tradetron

To connect TradingView with Tradetron, you link an API OAuth token to your Tradetron strategy, set your TradingView alert's webhook URL to https://api.tradetron.tech/api?, and put the token plus key/value pairs in the alert message. Each alert sets runtime variables; your strategy reads them with Get Runtime and places the trade.

How TradingView alerts drive a Tradetron strategy through a webhook, in 3 minutes. हिन्दी में देखें: TradingView alerts से Tradetron तक: webhook link असल में कैसे काम करता है, 3 मिनट में

Illustration of a chart alert being connected by a cable to an automated strategy

TradingView is good at charts and alerts. Tradetron is good at running a strategy and sending orders to your broker. A webhook joins the two.

Five-step flow: a TradingView alert fires, a webhook posts the token and key/value pairs to Tradetron, runtime variables are set, the strategy's conditions read them, and an order is recorded (Live Offline) or sent to the broker (Live Auto)What happens between your TradingView alert and an order

When your alert fires, TradingView sends an HTTP POST to Tradetron. The message carries your strategy's token and one or more variable names with values, for example Crude_long = 1. Tradetron stores those as runtime variables on that strategy. Your conditions compare them ("is Crude_long equal to 1?"), and when a condition is true, the positions you defined in that set are taken.

What you need before you start

  • A paid TradingView subscription. Alerts with a webhook URL are not available on the free plan.
  • A Tradetron strategy you own, built to read the variables your alerts will send. You can start with a simple one-instrument strategy.
  • A basic feel for the condition builder. Every condition must return true or false, and once an entry is taken, that set's entry is checked again only after its exit has fired.
  • A broker connected to Tradetron if you want real orders later. Not needed for testing.
  • One alert per instrument. If your Pine Script runs on a list of symbols, each symbol needs its own alert and variables.

Step 1: Set up the alert condition in TradingView

The example in this guide trades Crude Oil futures on a simple moving-average crossover: go long when SMA 2 crosses above SMA 5, go short when it crosses back below.

  1. Open the chart for your instrument in TradingView. The example uses Crude Oil futures.
  2. Add your indicators. Here, SMA 2 and SMA 5.
  3. Open Alerts and click Create Alert.
  4. Set the condition. In the example, the alert fires when SMA 2 crosses SMA 5 from below.

TradingView chart of Crude Oil futures with SMA 2 and SMA 5 indicators addedThe two moving averages on the chart

TradingView menu with the Create Alert optionCreate a new alert

TradingView alert dialog with the condition SMA 2 crossing SMA 5The alert condition: SMA 2 crosses above SMA 5

Step 2: Generate the API token on Tradetron

The token is what tells Tradetron which strategy an alert belongs to. It is bound to one strategy template and cannot be used for another.

  1. Go to My Strategies in your Tradetron account.
  2. Click the three dots on your strategy and choose API OAuth Token.
  3. Set Hybrid Mode = Yes, then click Link. If the strategy is already linked, click Unlink first, set Hybrid Mode to Yes, then Link again.
  4. Copy the token that appears. The same page shows a sample link you can use later to test.

Tradetron My Strategies page with the three-dot menu open and API OAuth Token highlightedOpen API OAuth Token from the strategy's menu

The API OAuth token menu on TradetronThe token menu

Tradetron showing a newly generated API token after linkingAfter linking, the token is shown here

Why Hybrid Mode matters

With Hybrid Mode off, API signals skip the strategy's own checks. That means your Tradetron-side target, stop loss, Universal Exit and repair conditions will not fire. With Hybrid Mode on, the alerts and your Tradetron logic run together. For most traders, that is what you want: the alert finds the trade, Tradetron manages the risk.

Step 3: Point the TradingView alert at Tradetron

In the alert dialog, open the notifications section, tick Webhook URL, and enter exactly:

https://api.tradetron.tech/api?

The ? at the end is part of the URL. Older copies of this guide left it out. Your token does not go in the URL: it travels in the alert message.

TradingView alert notification settings with the Webhook URL box tickedTick Webhook URL and paste the Tradetron address

Step 4: Write the alert message

The message is one JSON object: your token, then variable names and values in pairs. For the long alert in the example, you want three things to happen: switch the long signal on, send the number of lots, and switch the short signal off.

{"auth-token":"<your token>","key":"Crude_long","value":"1","key1":"Crude_long_lots","value1":"1","key2":"Crude_short","value2":"0"}

Then create a second alert for the opposite crossover (SMA 2 crossing below SMA 5) that does the mirror image:

{"auth-token":"<your token>","key":"Crude_short","value":"1","key1":"Crude_short_lots","value1":"1","key2":"Crude_long","value2":"0"}

TradingView alert message box with the JSON body for the long signalThe long alert's message

TradingView alert for the opposite crossover with the JSON body for the short signalThe short alert uses the same token and mirrored variables

The variable names differ between the two alerts, but the token is the same, because both alerts drive the same strategy.

Step 5: Build the strategy that reads the alerts

Now create the strategy on Tradetron. The example uses two sets: Set 1 for the long side, Set 2 for the short side.

Set 1 entry condition

Tradetron condition builder showing Set 1 entry: start time, Get Runtime of Crude_long equal to 1, and a Positions Detail checkSet 1 entry: trade only when Crude_long = 1 and no position is open

  1. A time condition says when the strategy is allowed to start trading.
  2. Get Runtime("Crude_long") is equal to 1 reads the variable the alert sent.
  3. A Positions Detail check makes sure only one side is open at any time.

Set 1 position, with the quantity from the alert

Tradetron position builder for Set 1 with the Crude Oil futures legThe Set 1 position

In the quantity field, choose Fx (formula) and use Get Runtime Number("Crude_long_lots"), so the lots come from the alert.

Quantity formula using a Get Runtime keyword with the variable Crude_long_lotsLots read from the alert

Set 1 exit condition

Tradetron condition builder showing the Set 1 exit condition based on the Crude_short variableSet 1 exits when the short signal arrives

Set 2 mirrors Set 1: it enters short on Crude_short = 1, reads Crude_short_lots for quantity, and exits when the long signal comes back.

Reset the signal once it has been used

A webhook variable keeps its last value until something changes it. If Crude_long is still 1 when the position closes, the entry can fire again straight away. Two ways to prevent that:

  • In the entry condition's Set Runtime (runtime variables) section, set the variable back to 0 once the trade is taken.
  • Or send another webhook call that sets it to 0.

If the strategy is intraday, pair your starting variables with a Universal Exit at the end of the day, so each day starts clean.

Step 6: Test it before real money

  1. Deploy the strategy in Live Offline. The strategy runs and records every trade, but nothing is sent to the exchange.
  2. Send a test signal without TradingView. Paste the sample link from the token page into your browser, with your variable name and value, during market hours.
  3. Check Runtime Data on the deployment. The value you sent should appear there.
  4. Watch the condition fire on the next check, and the position appear under the deployment.
  5. Now trigger each real TradingView alert once, still in Live Offline, and confirm each one does what you expect.
  6. Switch to Live Auto with your broker only when every alert has behaved correctly.

Runtime Data view on a Tradetron deployment showing the variables received from TradingViewRuntime Data shows each variable the webhook set

What you see Most likely cause
Nothing appears in Runtime Data Wrong or old token, missing ? in the URL, or pairs out of order
Value appears, but no trade Hybrid Mode off, market closed, a position already open, or the flag was never reset
Trade fires twice The signal variable was not reset to 0 after the entry
HTTP 429 from the webhook Too many calls in a short time: space your alerts out

Related guides: keywords in Tradetron, how to deploy a strategy, how to debug a strategy and connecting Amibroker with Tradetron.

Frequently asked questions

Can I connect TradingView to Tradetron for free?

Tradetron's webhook needs no extra setup on its side, but TradingView only allows webhook alerts on its paid plans. On a free TradingView account you cannot send alerts to Tradetron.

What is the Tradetron webhook URL for TradingView?

Use https://api.tradetron.tech/api?, including the question mark at the end. Your token and variables go in the alert message as JSON, not in the URL.

Can I backtest a TradingView alert strategy on Tradetron?

No. The backtester cannot replay webhook signals from the past, so an alert-driven strategy has nothing to test against. Forward-test it in Live Offline instead, where it runs on live prices and records trades without sending orders.

Why did my TradingView alert not trigger a trade on Tradetron?

Check Runtime Data first. If the variable never arrived, the token, the URL or the pair order is wrong. If it arrived but nothing traded, check Hybrid Mode, market hours, whether a position was already open, and whether an old signal value was left at 1.

How do I put a stop loss on a TradingView strategy that runs on Tradetron?

Put it inside the Tradetron strategy rather than in TradingView. With Hybrid Mode on, a position's stop loss and target, a trailing stop or a Universal Exit keep running on Tradetron even while alerts arrive. That way the exit does not depend on an alert being delivered.

Is Pine Script easy to learn?

For simple indicators and alerts, yes: Pine Script is short and TradingView's editor shows errors as you type. You don't need Pine Script for this integration, though. Any built-in TradingView alert condition can send the webhook.

Can one alert trade several symbols?

Each alert should drive variables for one instrument. If your Pine Script scans a list of symbols, create an alert and a pair of variables for each one, all using the same strategy token.

Want to join Tradetron?

Thousands of traders have moved to algo trading. Leave your number and our team will help you get started.