Preface to the second edtion

Since the first edition has been published in 2018, I have received numerous comments on how to improve the book. The second edition attempts to accommodate these suggestions as much as possible.

The book is completely rewritten and reorganized. In particular, the core part of trading rule is now divided into three chapters: day-trading rule, non-day trading rule, and complex trading rule.

  • Day-trading rule requires only basic knowledge of conditional if statements and for loops.

  • Non-day trading requires the reader has a better grasp of programming. The professional record keeping package blotter is also introduced.

  • Complex trading rule introduces the professional quanstrat package.

This version also includes two new chapters on technical analysis:

  • A new chapter on technical indicators provides a detailed discussion on various technical indicators. In the previous edition, we only cover TTR package for common indicators. Since less common indicators are sometimes used, we now illustrate how to calculate technical indicators from the first principle. Reading this part in detail would help readers with less programming experience to familiarize basic usages of conditional and iterative statements.

  • Another new chapter on candle stick pattern discusses how to identify a candle stick pattern using R. It is closely related to my own CandleStickPattern Package.

While I have moved material peripheral to technical trading (statistics, plotting, scrapping and Markdown) to the appendix, they should be also read as they are often needed before or after technical analysis.

Last but not the least, I include more examples and exercises to this new edition. Indeed, one of the best way to learn programming in R is to work on a problem.

Chiu Yu Ko