Page 1 of 1

Assigning to variable based on ticker

Posted: Wed Sep 22, 2021 1:36 am
by SoulSatori
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!