Can key value pair in tradingview alert message can value be string instead of 1. Give examples — Tradetron Community
← Community

Can key value pair in tradingview alert message can value be string instead of 1. Give examples

General 0 views

Prashant kulkarni

Can key value pair in tradingview alert message can value be string instead of 1. Give examples

Ask TT AI

Short answer: The value doesn't have to be 1. Tradetron's sources show other numbers being sent, such as a price. They don't confirm that a text value like "BUY" works. The safe, documented way is to send numbers and give each number a meaning, for example 1 = buy and 2 = sell.

What the sources do confirm

  • TradingView sends variables and values to https://api.tradetron.tech/api? as JSON, always in pairs. The ? at the end is part of the URL.
  • Your strategy reads them with Get Runtime keywords, for example Get Runtime Number("nifty_buy") == Number(1).
  • The value can be any number. You can reset a variable to "0 (or any value you want)". One Community example sends the price with the alert and enters once price has moved 10 points: thread.

Steps to use more than just 1

  1. In Initialize Variables, declare each variable you'll send, starting at 0, e.g. signal = Number(0). The name must match the alert exactly.
  2. Link the API token: My Strategies → ⋮ → API OAuth → Hybrid Mode Yes → Link. Hybrid Mode lets Tradetron's own conditions (like target/stoploss) run as well.
  3. Give each number a meaning and check for it in your conditions (see the examples below).
  4. Reset the variable after it's used. Either set it back to 0 in the runtime of the condition that used it, or send another alert that sets it to 0. Otherwise a leftover value can trigger again once the position closes.

Examples

Variable Value sent Condition in Tradetron
signal 1 (long entry) Get Runtime Number("signal") == Number(1)
signal 2 (short entry) Get Runtime Number("signal") == Number(2)
signal 3 (exit everything) Get Runtime Number("signal") == Number(3)
entry_price 22450.5 (a price) Compare it with the current price, as in the thread above

One variable with coded numbers can carry several instructions, instead of using a separate on/off variable for each.

About text values: none of the sources I found say whether text values (e.g. "BUY", or a stock symbol) are accepted or how you'd read them back. Please ask in the chat on tradetron.tech before relying on them.

Exact JSON format: I don't want to guess the field names. These walk through the alert message step by step:

Webhook alerts need a paid TradingView plan. The API allows 3 calls a second, 30 a minute and 250 an hour; going over any of these returns HTTP 429.

:sparkles: Answered by Ask TT (AI) from Tradetron’s docs. It can be wrong: check before you trade, and reply if something is off. Not investment advice.

Tradetron अब हिन्दी में भी उपलब्ध है हिन्दी में देखें Continue in English