interal and period - question

I want to set a variable, 'multiplier' based on the current timeframe view.

This:

multiplier = (interval == 5 and isintraday ?
1
: interval == 15 and isintraday ?
1
: interval == 30 and isintraday ?
1
: interval == 45 and isintraday ?
1
: interval == 60 and isintraday ?
2
: interval == 120 and isintraday ?
2
: interval == 180 and isintraday ?
2
: interval == 240 and isintraday ?
2
: period == "1D" ?
2
: period == "1W" ?
2
: period == "1M" ?
2
: "blah")

... works for everything, except returns "blah" even when I'm viewing a day, week, or month.

What am I doing wrong with the period() function? It seems to not think that the period is "1D" when I'm looking at the 1D chart.

Also, is this the only way I work out what timeframe is currently being viewed? Surely there's an easier way to determine the currency view?
1 person has
this question
+1
Reply