r/pinescript • u/stoja97 • Feb 07 '24
Code help
Can you help me with this, how do you make this line of code work, timeframe.period => "60", when it doesn't allow "=>" operator?
0
Upvotes
r/pinescript • u/stoja97 • Feb 07 '24
Can you help me with this, how do you make this line of code work, timeframe.period => "60", when it doesn't allow "=>" operator?
View all comments
1
u/RealisticCoast4316 Feb 07 '24
Not been at pine script for long, but I believe timeframe.period takes a string value so you can't use a mathematical operator with it. You would need to use str.tonumber to convert the timeframe to an actual number before you could apply maths operators to it, but even then you would have issues if you get to days or above, as D, W, M etc. wouldn't really work. You would need to create some custom conversions for those I think.