askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.07k stars 3.94k forks source link

backtesting zenbot strategy on gekko #723

Closed ak9250 closed 7 years ago

ak9250 commented 7 years ago

has anyone been able to recreate zenbot strategy on gekko and backtest it?

https://github.com/carlos8f/zenbot

I tried their parameters with rsi but the backtesting does not look good maybe I am doing it wrong

is their extra functionality that gekko does not support in their strategy?

generalectric commented 7 years ago

Gekko doesn't currently support buy and sell percentages. The rest of it would have to be tweaked but you can pretty much do anything with the strategies short of having different indicators for different candle sizes.. Stop loss for instance or mix and match indicators and the trigger requirements for a short or long are really just some if else statements with parameters wired to the config and tweaked to get desired backtest results. The talib-macd strategy is a good place to start if you're interested in creating your own custom strategy.

askmike commented 7 years ago

@generalectric is very correct.

Gekko doesn't currently support buy and sell percentages.

The trader is about to get a big overhaul and this might be one of the new features!


I looked at zenbot before but it looks unmaintained. Also when looking at the source code I fail to understand how strategies work in zenbot and what zenbot can actually do. But I can tell you that these features advertised in the readme:

  • High-frequency trading, day trading, week trading
  • Realtime consuming and analysis of trade data
  • A powerful map/reduce system to live-process data at scale.
  • Out of the box, Zenbot is an AI-powered trade advisor

Are not features of Gekko.

If anyone can point me in the direction of how the default strategy works I can try to implement that in Gekko.

ak9250 commented 7 years ago

@askmike Im kind of confused by their logic right now as well

seems the rsi is backwards? https://github.com/carlos8f/zenbot/issues/102

I did some more backtesting with rsi and got this result

screenshot 137 screenshot 135

generalectric commented 7 years ago

@askmike I wouldn't waste your time with it we need you focusing on all the other great work you've been doing xD. As for zenbot strategy it's just a custom strategy with parameters for long and short percentages and timing between trades to prevent rapid trading. Personally I think strategies are something that should be created and shared by end users should they choose to share.

@ak9250 you should read up on technical indicators. Rsi > 70 is overbought and should be sold. Below 30 is oversold and should be bought. The trick is setting Rsi to the right time period for the candlesize and history to achieve correct overbought/oversold signals at 70/30 for long term profit

ak9250 commented 7 years ago

@generalectric yes I familiar with how rsi works it just seems to be backwards on zenbot what do you think of the strategy I posted? I going to test over longer time period but the sharpe ratio is high over 2 which is good if we can get it over 3 excellent

generalectric commented 7 years ago

I apologize, I misunderstood. For better results you will need to either combine native indicators or create a custom strategy which is simple enough if you start with copying talib-macd and modify it to switch to other indicators or add multiple ones which will give you overall results of combined indicators. The easiest way would be combining native indicators. You can run a gekko on watch only and then make configs for each strategy/indicator and run those simultaneously with candlewriter off to combine them... though a downfall is figuring out the results of a buy or sell from different processes. Good luck!

askmike commented 7 years ago

@ak9250: I did some more backtesting with rsi and got this result [..] I going to test over longer time period but the sharpe ratio is high over 2 which is good if we can get it over 3 excellent

That result (24%) does not look bad, but note that the market made 53% (eg the price went up 53% during that testing period, so if you would have just bought and hold you would have made twice the profit). When backtesting always try to look at the big picture as well as individual trades. If you are backtesting over a period where the price went up a lot, you'll almost always be in the positive. But assuming the price will keep going up like that is dangerous (if you assume that you don't have to trade at all, you can just hold).


@generalectric made a lot of good points. The main thing I like to add is: experiment a lot, remain skeptical. Backtest a lot (watch out for overfitting) after that paper trade (or use tiny amounts of money) and stay skeptical.


I am going to close this as I don't really see how we can get Gekko to do anything zenbot is doing. The way I understand it is that there is a default strategy that is apparently losing money for a lot of people and the project is unmaintained at the moment (if it does work for you, great!). Gekko is not a full auto tradebot (what zenbot aims to be) - it's a platform for creating your own strats. We can put example strats in there (that mimic zenbot for example) as soon as someone can explain how those work. Feel free to keep commenting on here though.