I want to write an indicator for tradingview that should draw a vertical line on a specific level depending on the active time frame, e.g. on the 5-minute-chart the indicator should draw the line at a different level than on the 60-minute-chart.
I have allready tried "resolution". Here is a snippet of the code:
x = (resolution == "5") ? 10 : (resolution == "60") ? 20 : 30
plot(x)
So this should draw a line at level 10, if the chart is on the 5-minute-time-frame, at level 20 on the 60-minute-time-frame and at level 30 for all other time frames.
But it allways draws at level 30, so the code has to be incorrect. I allready researched that "resolution" is a constant of the "input"-function, so it seems that it cannot be used outside of this function.
So my question is: What is the right code? Thank you!
I have found the answer myself: "period"
So my example code has to look like this:
x = (period == '5') ? 10 : (period == '60') ? 20 : 30
plot(x)