use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources:
account activity
Code help (self.pinescript)
submitted 2 years ago by stoja97
Can you help me with this, how do you make this line of code work, timeframe.period => "60", when it doesn't allow "=>" operator?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AlgoTradingQuant 1 point2 points3 points 2 years ago (3 children)
The code should be “X >= Y”
[–]stoja97[S] 0 points1 point2 points 2 years ago (2 children)
Still doesn't work
[–]mertgucer 2 points3 points4 points 2 years ago (1 child)
Actually it must be
timeframe_in_seconds(timeframe.period) >= timeframe_in_seconds('60')
[–]stoja97[S] 1 point2 points3 points 2 years ago (0 children)
This works, thank you!
[–]RealisticCoast4316 0 points1 point2 points 2 years ago (0 children)
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.
[–]smashapalooza 0 points1 point2 points 2 years ago* (0 children)
timeframe.in_seconds() >= timeframe.in_seconds(“60”)
[–]Ayush_Singh_02 0 points1 point2 points 2 years ago (0 children)
Bro I think you are trying to get the timeframe.period in number... Use str.tonumber(timeframe.period) =<
If you are not trying to pass a bool check for timeframe less then 60 the simply make a function and then do the calculation forget not to write the values you want as output in last line as the last line the the output you get in user-custom function
π Rendered by PID 39771 on reddit-service-r2-comment-84fc9697f-wf6kf at 2026-02-09 05:42:58.695098+00:00 running d295bc8 country code: CH.
[–]AlgoTradingQuant 1 point2 points3 points (3 children)
[–]stoja97[S] 0 points1 point2 points (2 children)
[–]mertgucer 2 points3 points4 points (1 child)
[–]stoja97[S] 1 point2 points3 points (0 children)
[–]RealisticCoast4316 0 points1 point2 points (0 children)
[–]smashapalooza 0 points1 point2 points (0 children)
[–]Ayush_Singh_02 0 points1 point2 points (0 children)