Select Page

Before moving forward, please take note of the following pre-requisites for using APIBridge and Pinescript.

1. Please understand the format APIBridge takes from Tradingview in different examples from here.

2. Please note Pinescript tutorial given here.

3. Please note here, how to setup multiple strategy tags in APIBridge.

Now, Coming to the requirement, we give an example. Assume you want to run the strategy given in step 2 above with STG2 and STG3

(A) In the pinescript code, look for code which generates alert output. In this case it is two lines
m=” :SYMBOL:”+syminfo.ticker+” :QTY:”+tostring(q1)
m1=” :SYMBOL:”+syminfo.ticker+” :QTY:”+tostring(q)

(B) Add strategy tags to these two lines
m=” :SYMBOL:”+syminfo.ticker+” :QTY:”+tostring(q1)+ “:STAG:STG2”
m1=” :SYMBOL:”+syminfo.ticker+” :QTY:”+tostring(q)+ “:STAG:STG2”

(C) Add this pinescript on a chart. Similary open another chart and edit pinescript for STG3
m=” :SYMBOL:”+syminfo.ticker+” :QTY:”+tostring(q1)+ “:STAG:STG3”
m1=” :SYMBOL:”+syminfo.ticker+” :QTY:”+tostring(q)+ “:STAG:STG3”

Now, you will have two charts, one giving alerts with STG2 and other giving alerts with STG3

Attaching below an example from editing the supertrend strategy pinescript:

Important Note: Please note that you do not require to make any changes in the Strategy Tag option of Trading extension button, it can be kept as STG1 default.