Connecting R to Zorro for Trading Research and Backtests
Summary
This tutorial describes how to connect the R statistical environment to Zorro, allowing a Zorro script to send market data to R, run R computations, and retrieve results. It outlines configuring the R installation, starting and checking an R session, and choosing whether commands run synchronously or asynchronously. The examples cover passing scalar values and vectors, transferring recent closing prices, displaying R output, and reading a scalar or vector back into Zorro.
The workflow is useful when an analysis or model is more convenient to implement in R while simulation and trading logic remain in Zorro. The document also notes that asynchronous use requires checking whether R is ready before sending another request, and it shows a basic approach to installing missing R packages. It is an integration guide rather than a strategy evaluation: it provides example procedures but no evidence about trading profitability, model validity, or execution quality. Users must handle their own package compatibility, data conventions, and validation.
Key ideas
- Zorro scripts can use an R bridge to run statistical computations within a trading workflow.
- The bridge supports synchronous execution and several asynchronous modes with different output and interruption behavior.
- Scalar values, arrays, and price series can be passed from Zorro to R.
- R can return individual values or vectors for use in Zorro scripts.
- The examples explain software integration, not whether any resulting model has a reliable trading edge.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.