ComenzarEmpieza gratis

Build an EMA-based signal strategy

Previously, you implemented an SMA-based signal strategy. However, you are wondering whether the EMA (exponential moving average) indicator is a better choice since it is more sensitive to recent price movement. You also would like to leverage the talib library to calculate the indicator. After switching to an EMA-based signal strategy, you will perform a similar backtest using the Apple stock price data.

The bt and talib packages have been imported for you. Also, the historical price data of the Apple stock has been preloaded in price_data.

Este ejercicio forma parte del curso

Financial Trading in Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Calculate the EMA
ema['Close'] = ____(price_data['Close'], ____)
Editar y ejecutar código