How can I get Moving averages and Field Prices in multiple timeframes?
I had the same question a few day ago, I fould inspiration here and got my things working. Other members of community inspired me to do a search and I found this:
For moving averages specifically, I use a simple approximation.
Say you have a 5min chart, and you want to get the 20 ema on a 15min chart, well, the 15min is just 3x 5min candles, so a 20 candles on the 15 min chart is really just 3x20 = 60 candles on the 5min chart.
Timeframe functions are good, but be careful around indexes as you'll have to know how to limit any array indexing to the timeframe you are on.
60 bars MA on 5min chart is not exactly the same as 20 on 15min chart, as the number of bars involved in calculation are different.
Another solution is to use different MAs with the same period on the same chart. One normal, one slow. Slow MA emulates higher timeframe.