Adding all gekko backtest tick data and indicators to csv

If you’re like me you want to see exactly what your indicators are doing vs the candle data. You can do this really easily by writing everything out to a csv file. Below is the simple instructions that you need to do to achieve this:

Writing CSV of strat output candles

Install fs

Add this to the top of the strat: var fsw = require(‘fs’);

Add this in .update under your logic etc I’ve used adx as an example:

grreadtime = candle.start.toDate();

headertxt = “date,price,adx,buys (USD),sells (BTC)\n”;

outtxt = grreadtime+”,”+ price+”,”+adxresult+”,”+buytime+”,”+selltime+”\n”;


fsw.appendFileSync(this.fname, headertxt, encoding=’utf8′); headerset = “1”;


fsw.appendFileSync(this.fname, outtxt, encoding=’utf8′);

outtxt = “”;