Select Page

In the alert message box, you can define the following, each on a new line. All constants such as SYMBOL/TYPE should not be misspelled, “:” colon symbol acts as a separator and TYPE should be on top of group.

NOTE:

1. Values in Alert box are given precedence over values in Extension settings.

2. TradingView Algo Update – March 1, 2021: When setting up alerts through charts, leave the alert name blank. If you setup alert name also, trades may not go properly. Refer to the screenshot below: 

TradingView Alert Settings:

  • TYPE: Mandatory. Should be either LE, LX, SE, SX or in pairs LX,SE and SX,LE
  • SYMBOL: Optional. Provide here your own symbol which also needs to be provided in Bridge in Symbol Settings as Input Symbol
  • PRICE: Optional, PRICE from msg box, otherwise (b) take from Chart else (c) Price is 0 for market orders. You can define {{close}} to pick price dynamically from Chart.
  • TRIG: (optional)
  • SL: Optional, SL for Bracket Orders. If provided, it has higher precedence than SL provided by Extension settings
  • TGT: Optional, Tgt for Bracket Orders. If provided, it has higher precedence than SL provided by Extension settings
  • STAG: Optional, Strategy Tag
  • INS: Optional, instrument. It has higher precedence than INS provided by Extension settings
  • Qty: Optional, It has higher precedence than Qty provided by Extension settings
  • Trail: Optional, for use in Bracket Order

New in Extension v4.4.2 Compared to v3.4

  • Does not truncates the numeric part of the symbol from the chart. Example: chart symbol CRUDEOILV2020 is received in APIBridge as CRUDEOILV2020 only, not CRUDEOILV. You need to keep the input symbol the same as chart = CRUDEOILV2020
  • You can use advanced full-powerful alerts similar to Amibroker. See examples here.
  • You can change the default port – useful for multiplatform trading
  • You can trade in multiple accounts by using comma-separated ports under “custom ports”.

Examples:

Example 1: Sending Market order through alert for Long Entry. 

Copy following values in alert:

TYPE: LE

SYMBOL: SBIN

In APIBridge, enter following values:

Example 2: Sending Limit order through alert for Long Exit.

Copy following values in alert:

TYPE: LX

PRICE: 310

(If you do not know price, put {{close}} to get current price )

In APIBridge, enter following values:

Example 3: Sending SLL Order through alert

TYPE: LE

PRICE: 310

TRIG: 305

(TRIG is used for trigger price, and PRICE is used for limit price in SLL order)

Example 4: Sending SLM Order through alert

TYPE: LE

TRIG: 305

(TRIG is used for trigger price)

Example 5: Sending Cover Order through alert

TYPE: LE

PRICE: 310

SL: 5

Example 6: Sending Bracket Order through alert

TYPE: LE

PRICE: 310

SL: 5

TGT: 10

Example 7: Buying Call Option based on Spot Index

TYPE: LE

SYMBOL: NIFTYCALL

This image has an empty alt attribute; its file name is image-5.png

Example 8: Entering fresh Long position and exiting previous Short

TYPE: LE,SX

SYMBOL: NIFTYCALL

Example 9: Creating Options Straddle based on Index Sell signal

(put entire text below in same message box)

TYPE: LE

SYMBOL: NIFTYCALL

TYPE: LE

SYMBOL: NIFTYPUT

Example 10: Create Call Butterfly Spread based on Index Buy signal

(Put entire text below in same message)

TYPE: LE
SYMBOL: NIFTYCALLA

TYPE: SE
SYMBOL: NIFTYCALLB

TYPE: LE
SYMBOL: NIFTYCALLC

Example 11: How to trade in single stock using Multiple Strategies in TradingView

To trade in single stock with multiple strategies you need to provide the strategy tag in pine script code itself and setup different alerts for each strategy with {{strategy.order.comment}} in the alert message box. 
 

Please append ” :STAG:STG1 ” or  ” :STAG:STG2 ” as required along with the signal conditions in the section given below. A sample is attached for your reference. 
 

//setting automated alerts required by apibridge 
lxse= “TYPE: LX”+” :SYMBOL: “+syminfo.ticker+” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant)+” :TYPE:SE “+” :SYMBOL: “+syminfo.ticker +” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant) + ” :STAG:STG2 ” 

sxle= “TYPE: SX”+” :SYMBOL: “+syminfo.ticker+” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant)+” :TYPE:LE “+” :SYMBOL: “+syminfo.ticker +” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant) + ” :STAG:STG2 ” 

LE  = “TYPE:LE “+” :SYMBOL: “+syminfo.ticker +” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant) + ” :STAG:STG2 ” 

LX  = “TYPE:LX “+” :SYMBOL: “+syminfo.ticker +” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant) + ” :STAG:STG2 ” 

SE  = “TYPE:SE “+” :SYMBOL: “+syminfo.ticker +” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant) + ” :STAG:STG2 ” 

SX  = “TYPE:SX “+” :SYMBOL: “+syminfo.ticker +” :PRICE: “+tostring(close)+” :QTY: “+tostring(quant) + ” :STAG:STG2 ” 

Also, please make sure you add the scrip in APIBridge symbol settings multiple times as per the requirements. 

Do you want coding help to deploy your own strategy for live trading? Check our coding assistance.