We will test the crypto on Bitmex, since there you can easily get ticks with directions for free.
Actually, the idea is very simple:
— buy if the sum of the volumes of the last 5 trades is more than 500,000
– sell if the sum of the volumes of the last 5 trades is less than -500,000
We trade one conditional bitcoin (ticker XBTUSD).
We'll use R and the QuantTools package.
Let's write a little bit of code:
Results:
Everything was calculated in about 38 seconds. Of these, 30 seconds were spent reading ticks from the disk. Below is a time profiling table in milliseconds: