Session Ready
Exercise

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.

Instructions
100 XP
  • Use add.indicator() on your existing strategy strategy.st. Follow the example code from previous exercises.
  • Provide the RSI function as the name argument.
  • Specify the desired arguments of RSI, using the closing price of mktdata and a lookback period n of 3 days. Don't forget to use the quote() function!
  • Label your new indicator "RSI_3".