Skip to Content
R Programming By Example
book

R Programming By Example

by Omar Trejo Navarro
December 2017
Beginner to intermediate
470 pages
12h 29m
English
Packt Publishing
Content preview from R Programming By Example

Our first (very inefficient) attempt at an SMA

As was mentioned earlier, we will work with SMA implementations for the rest of the chapter. To differentiate among them, we will change the function name for each subsequent implementation, starting with sma_slow_1(). All SMA implementations will receive the following parameters:

  • period: To specify how many observations to use for the SMA.
  • symbol: To denote the asset we want to make the calculations for
    • For this example, options will be  BTC for Bitcoin or LTC for Litecoin. However, when you execute the system yourself, you'll be able to expand it with any cryptocurrency symbol you so desire.
  • data: The actual data that contains the price time-series for every asset.

We will make two assumptions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Efficient R Programming

Efficient R Programming

Colin Gillespie, Robin Lovelace
R Programming

R Programming

Jared P. Lander

Publisher Resources

ISBN: 9781788292542Supplemental Content