LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Financial Trading in Python

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Calculate the EMA
ema['Close'] = ____(price_data['Close'], ____)
Code bearbeiten und ausführen