Timeframe ="" parameter not contain second time frame

Viewed 33

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.

1 Answers

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)
Related