1

Currently the parameter timeframe = "" of

Indicator(title , overlay , timeframe="")

doesn't include seconds time frame. timeframe parameter only have minutes , hours , weeks and months time frames. But does not include seconds, 1 second , 2 seconds.

How to add seconds to timeframe ="" parameter . Or any other parameter we can change with timeframe ="" , to add seconds.

vitruvius
  • 15,740
  • 3
  • 16
  • 26

1 Answers1

1

The default timeframes are limited.

You can, however, use a user input to get any timeframe you want. Even, the ones that are not listed in that drop down menu.

The resolution argument allowable values are:

  • 1S, 5S, 10S, 15S, 30S - for seconds intervals (chart resolution should be less than or equal to the requested resolution)
  • from 1 to 1440 for minutes
  • from 1D to 365D for days
  • from 1W to 52W for weeks
  • from 1M to 12M for months

Then you need to use the security() function to get the value from different timeframes.

tf = input.string("5S", "Timeframe")
sma_val = ta.sma(close, 9)
sma_mtf = request.security(syminfo.tickerid, tf, sma_val)
vitruvius
  • 15,740
  • 3
  • 16
  • 26
  • Hello thanks for the reply. But if we code as you write we have to set chart time frame same as of indicator time frame. Rigth. I want to set chart time frame into minutes and indicator time frame into seconds. If we can see seconds in timeframe ="" parameter . We can set chart time frame to minutes, hours , weeks , months and set indicator time frame to seconds. That is what ever time frame we set the chart , the indicator shows seconds values. – sooraj kdas Sep 05 '22 at 16:57
  • You can have multiple `secuirty()` calls if you need to analyze different timeframes. Unfortunately, you cannot have seconds timeframe in that drop-down menu at the moment. – vitruvius Sep 05 '22 at 17:21