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 exercício faz parte do curso
Financial Trading in Python
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Calculate the EMA
ema['Close'] = ____(price_data['Close'], ____)