SoulSatori
Pine Script Rookie
Pine Script Rookie
Posts: 3
Joined: July 2nd, 2021
Contact: TradingView Profile

Assigning to variable based on ticker

Hello,

I'm wanting to assign a value to a variable based on the ticker. It's for a script using the renko function.

Example:

gbpusd = 1.05
gbpaud = .056
usdjpy = .268


t = 0.0

if syminfo.ticker == "GBPUSD"
t := gbpusd

if syminfo.ticker == "GBPAUD"
t := gbpaud

if syminfo.ticker == "USDJPY"
t := usdjpy




Is there a quicker way to do this for all symbols?

I'd imagine this is where list come into play?

Thank you in advance!

Return to “Pine Script Q&A”