I'm looking to make an 15m EMA crossover strategy but i'm running into trouble with the output of the EMAs. I know that the data quantopian has might be different then the broker that i'm using but i'm still not 100% sure how the EMA is calculated using TALIB. As the algo runs does it calculate the EMA based on the current price or the closing price of the 1 minute candle? And is that a accurate way to get the price of a 15 minute candle? Also when calculating how many bars do you need to look at to generate an accurate EMA
Below is what i'm using to try to generate the EMA
import talib
def initialize(context):
# ES
context.es_future = continuous_future("ES")
def handle_data(context, data):
my_future_series = data.history(context.es_future, fields="price", bar_count=600, frequency="1m")
ema_result = talib.EMA(my_future_series, timeperiod=120)
record(ema=ema_result[-1])
print(ema_result[-1])