#Zorro unity assets how to#
In the next post, I’ll show you how to configure Zorro to talk to R and thus make use of the Kalman filter algorithm.Įven the briefest scan of the pairs trading literature reveals many approaches to constructing spreads. We’ll stick with a static hedge ratio and focus on the pairs trading logic itself.
This post presents a script for a pairs trading algorithm using Zorro. But thanks to Zorro’s R bridge, I can use the R code for the Kalman filter that I’ve already written, with literally only a couple of minor tweaks. The downside with Zorro is that it would be pretty nightmarish implementing a Kalman filter in its native Lite-C code. I’ve already invalidated 3 ideas since starting this post But in my experience none of them let you experiment as efficiently as the Zorro platform.Īnd as an independent trader, the ability to move fast – writing proof of concept backtests, invalidating bad ideas, exploring good ones in detail, and ultimately moving to production efficiently – is quite literally a superpower. To be fair, there are good native R backtesting solutions, such as Quantstrat. Plus, it certainly isn’t simple to experiment with strategy design – for instance, incorporating costs, trading at multiple levels, using a timed exit, or incorporating other trade filters. Setting up anything more advanced than the simplest possible vectorised backtesting framework is tough going and error-prone. We saw that while R makes it easy to implement a relatively advanced algorithm like the Kalman filter, there are drawbacks to using it as a backtesting tool. In our previous post, we looked into implementing a Kalman filter in R for calculating the hedge ratio in a pairs trading strategy.