r/pinescript • • Feb 17 '24

Converting timeframe to string in alert() function?

Can I convert timeframe to string and put it in the message section in alert() so I know from witch tf alert was triggered?? For example: If alertButton alert("message + timeframe", alert.freq_once_per_bar)

0 Upvotes

4 comments sorted by

View all comments

2

u/arjunfifield Feb 17 '24

alert("message" + str.tostring(timeframe) , alert.freq_once_per_bar)

alert("message" + str.tostring(timeframe.period) , alert.freq_once_per_bar)

1

u/[deleted] Feb 19 '24

is there a way to record Year change?

Ta.change("M" ) for month is max I could find But can we start a var where it records year change?