© Chris Conlan 2016

Chris Conlan, Automated Trading with R, 10.1007/978-1-4842-2178-5_7

7. Simulation and Backtesting

Chris Conlan

(1)Bethesda, Maryland, USA

In this chapter, we will use the data and functions established thus far to build a backtester to simulate the results of trading with a given strategy. We will run our simulator with a few example strategies. We will introduce many practical trading considerations as we construct sample strategies.

Recall in Chapter 5 we established the indicator and rule set for a strategy from a composite function accepting stock data, D t , and account variables, A t , to output portfolio adjustments, ΔP t , as follows where f r and f i are the rule set and indicator functions, respectively. We will ...

Get Automated Trading with R: Quantitative Research and Platform Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.