Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Specific source timeframe

>Solution :

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

See this for more information.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading