This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.

Duration: 3:25

Level: Intermediate

Contributed By: QuantInsti

In this video, you will be introduced to R and RStudio and learn the benefits of using R for automated trading.

Read More

Study Notes:

Congratulations for enrolling in this course on Trading using R! We are sure that the course videos and the study material will be of great help in your goal for trading using R on Interactive Brokers platform. The course study notes have been divided into a number of lessons and have been designed in an easyto-understand language. Let’s get rolling and start off with the first lesson on introduction to R and RStudio.

In this lesson, you would:

• Get introduced to R and RStudio

• Know the difference between R and RStudio

• Learn the benefits of using R for automated trading

What is R?

R is a programming language used for scientific computing and graphics. The roots of R language can be found in the S programming language which was developed at Bell laboratories in the 1970s, mainly by John Chambers. The R language was conceived in the early 1990s by Ross Ihaka and Robert Gentleman. R also refers to the software environment which is used to run the programs written in R. The R environment is free and open-source software. R as a programming language has gained wide popularity in recent years and it ranks among the top programming languages for data science. This popularity has resulted on account of various factors like ease-to-learn, excellent data manipulation and visualization tools, thousands of contributed packages on CRAN (Comprehensive R Archive Network), ability to create your own packages, and a large developer community.

What is RStudio?

RStudio is an integrated development environment (IDE) that helps you develop programs in R. An integrated development environment (IDE) is a software application that provides a facility to programmers for easy software development. An IDE normally consists of a source code editor, build automation tools and a debugger. There are other IDEs for R like Visual Studio and Eclipse, however, RStudio is considered to be the best available IDE for R programming.

Difference between R and RStudio

It is important that you understand the difference between R and RStudio. You can use R without using RStudio IDE, but you cannot use RStudio without using R. In the RStudio configuration, an R version is required to be set which is usually auto-set by RStudio when it is installed. RStudio makes it easy for writing programs in R but it is not a must to use R.

Benefits of using R for Automated Trading

R has found application in numerous fields like Finance, Marketing, Manufacturing, Retail, Bio Science etc. Given its excellent data manipulation and visualization tools, it has also been successfully used for automated trading in financial markets. Following are the benefits of using R:

  • Free and Open-source software
  • Excellent built-in functions
  • Thousands of Contributed packages
  • Ability to create your own packages
  • Availability of packages like Quantstrat, QuantTools and PerformanceAnalytics for backtesting and analyzing trading strategies
  • Quick prototyping of back-tested strategies, thus requiring minimal code changes
  • Ability to figure out the difference between real life and back-tested data


In this introductory lesson, we talked about R, RStudio, and listed the benefits of using R for automated trading. In the next lesson, we will explain the installation guidelines for R and RStudio.

Additional Resources

List of Contributed Packages on CRAN, sorted by name

List of Contributed Packages on CRAN, sorted by data of publication

Note – The IBrokers package provides native R access to Interactive Brokers Trader Workstation API

Disclosure: Interactive Brokers

The analysis in this material is provided for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IBKR to buy, sell or hold such investments. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

Supporting documentation for any claims and statistical information will be provided upon request.

Any stock, options or futures symbols displayed are for illustrative purposes only and are not intended to portray recommendations.

Disclosure: R API Disclosure

This software is in no way affiliated, endorsed, or approved by Interactive Brokers or any of its affiliates. It comes with absolutely no warranty and should not be used in actual trading unless the user can read and understand the source. IBrokers is a pure R implementation of the TWS API.

trading top
Translate »