I have an algorithm that needs the 21 day Exponential Moving Average of symbol TQQQ on the Open price.

  • How do I compute the 21 day Exponential Moving Average of symbol TQQQ on the Open price? Currently I am doing this:
self.ema = self.EMA("TQQQ", 21 * 8, Resolution.Hour)

But how do I specify that I want the EMA to be applied only to the Open Price of TQQQ for the last 21 days? Is it correct to multiple by 8 (21 days times 8 hours/trading day) - to get to the 21 day average?

With Yahoo charts you can specify it as such:

183852_1645119810.jpg