Implementing an indicator - III
In financial markets, the goal is to buy low and sell high. The RSI can predict when a price has sufficiently pulled back, especially with a short period such as 2 or 3.
Here, you'll create a 3-period RSI, or RSI 3, to give you more practice in implementing pre-coded indicators. The quantstrat and quantmod packages are loaded for you.
Diese Übung ist Teil des Kurses
Financial Trading in R
Anleitung zur Übung
- Use
add.indicator()on your existing strategystrategy.st. Follow the example code from previous exercises. - Provide the RSI function as the
nameargument. - Specify the desired arguments of RSI, using the closing price of
mktdataand a lookback periodnof 3 days. Don't forget to use thequote()function! - Label your new indicator
"RSI_3".
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Add an RSI 3 indicator to strategy.st
add.indicator(strategy = strategy.st,
# Add the RSI 3 function
name = ___,
# Create a lookback period
arguments = list(___),
# Label your indicator RSI_3
label = ___)