简体   繁体   中英

Is there a way to take symbols out of the tickerid in pinescript?

I would apply this to Forex of course, so for example if i had chart of AUDJPY and

A = security(tickerid, period, close)

is there a possibility take the "AUD" and "JPY" from tickerid and store them as separate variables? thanks in advance

You need to use syminfo.basecurrency and syminfo.currency .

Example script:

//@version=4
study("AUDJPY split", overlay=true)

if (barstate.islast)
    var1 = syminfo.basecurrency
    var2 = syminfo.currency
    myText = "First=" + var1 + "\nSecond=" + var2
    label.new(bar_index, high, text=myText)
    
plot(na)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM