I have a tradingview indicator through which I send alerts to discord, the alerts are like this
msgr1=syminfo.ticker + ',' + timeframe.period + ', Crossed Resistance 1'
if srLines==true and close > h10
alert(msgr1)
The problem is timeframe.period
sends alerts in multiples of 60, so if timeframe of the chart is 2 hours it sends 120, and 3 hours is 180, and so on. This is confusing to interpret for discord members, so I thought that if I could detect if timeframe.period
is under a 1 day period then I could return timeframe after doing its modulus with 60
So I tried to do this
if timeframe.period < 1D
timeframe=timeframe.period%60
else
timeframe=timeframe.period
msgr1=syminfo.ticker + ',' + timeframe+ ', Crossed Resistance 1'
if srLines==true and close > h10
alert(msgr1)
This does not work, but is there any way I can code this in pinescript?
string timeframe = na
if timeframe.isintraday and timeframe.multiplier >= 60
timeframe := tostring(timeframe.multiplier / 60) + "H"
else if timeframe.isintraday and timeframe.multiplier < 60
timeframe := tostring(timeframe.multiplier) + "m"
else
timeframe := timeframe.period