'How to set timeframe for certain part of indicator in pine script

I want to create an indicator in pine script but I want to have 1 part of the indicator (lets say an EMA) set to 15 minute, and the rest (like pivot points and support/resistance lines) set to what ever the chart is.

I haven't written it yet but just want to see if this is possible.



Solution 1:[1]

Yes, you can do that using the security function.

Following example requests the close price from 15 min time frame.

//@version=4
study("Example security 1", overlay=true)
ibm_15 = security("NYSE:IBM", "15", close)
plot(ibm_15)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vitruvius