premium course

Financial Trading in R

Start Course For Free Play Trailer
  • 20 Videos
  • 65 Exercises
  • 5 hours 
  • 5,576 Participants
  • 5150 XP


Ilya  Kipnis
Ilya Kipnis

Ilya Kipnis is a professional quantitative analyst and R programmer. He received his M.S. degree in statistics in 2010 from Rutgers University, and has worked in the financial industry for several years. He is also a co-author in the book "Introduction to Quantitative Trading With R", and an internationally read quantitative research blogger. His work can be found at


Lore Dirick Lore Dirick

Josiah Parry Josiah Parry

Course Description

This course covers the basics on financial trading, and gives you an overview of how to use quantstrat to build signal-based trading strategies in R. It will teach you how to set up a quantstrat strategy, apply transformations of market data called indicators, create signals based on the interactions of those indicators, and simulate orders. Lastly, you will learn how to analyze your results both from a statistical and a visual perspective.

1Trading basics Free

In this chapter. you will learn what trading is, what the philosophies of trading are, and you will get an insight on the pitfalls that exist in trading. It will cover both momentum and oscillation trading, along with some phrases to identify these types of philosophies. You will learn what overfitting is, and how to avoid it. You will also learn how to obtain and plot financial data, along with a famous indicator.

A boilerplate for quantstrat strategies 

Before building a strategy, the quantstrat package requires you to initialize some settings. In this chapter you will learn how this is done. You will cover a series of functions that deal with initializing a time zone, currency, the instruments you'll be working with, along with quantstrat's various frameworks that will allow it to perform analytics. Once this is done, you will have the knowledge to set up a quantstrat initialization file, and know how to change it.


Indicators are crucial in your trading strategy. They are transformations of market data that allow a clearer understanding of the overall behavior of the market data, usually in exchange for lagging the market behavior. You will be working with both trend types of indicators, as well as oscillation indicators. You will learn how to use pre-programmed indicators available in other libraries, and also implement one of your own.


When constructing a quantstrat strategy, you want to see how the market interacts with indicators and how indicators interact with each other. In this chapter you'll learn how indicators can generate signals in quantstrat. Signals are interactions of market data with indicators, or indicators with other indicators. There are four types of signals in quantstrat: sigComparison, sigCrossover, sigThreshold, and sigFormula. By the end of this chapter, you'll know all about these signals, what they do, and how to use them.

Analyzing results 

After a quantstrat strategy has been constructed, it's vital to know how to actually analyze the strategy's performance. This chapter details just that. You will learn how to read vital trade statistics, and view the performance of your trading strategy over time. You will also learn how to get a reward to risk ratio called the Sharpe ratio in two different ways. This is the last chapter.