How to tell a function its specific source timeframe in code? Pine Script V5

The story is, for example, that I want get to the 200-hours EMA for using it in math, for obvious basic reasons. That’s practically the 50-pip/4h or 800-pip/15min EMA.

In the built-in EMA Indicator, we can select the source timeframe but the question is: how to simply tell the ta.ema(source,length) function in code to get the data from a specific timeframe?

Only this function, not any other in the code. (All the other expressions, functions in the indicator must work with the current timeframe.) The source code of the built-in EMA indicator doesn’t give a clue or it sticks out my eyes.

Specific source timeframe

>Solution :

You need to use the request.security() function for that.

See this for more information.

Leave a Reply