Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Different buy and hold number from different strategies #1727

Closed
moremorecoin opened this issue Oct 3, 2018 · 3 comments · Fixed by #2013
Closed

Different buy and hold number from different strategies #1727

moremorecoin opened this issue Oct 3, 2018 · 3 comments · Fixed by #2013

Comments

@moremorecoin
Copy link

moremorecoin commented Oct 3, 2018

System information

  • Have I written custom code (as opposed to using zenbot vanilla):
    no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
    Linux
  • Zenbot version (commit ref, or version):
$ docker-compose exec  server zenbot --version
(node:87) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
4.1.0
  • Zenbot branch:
    unstable
  • NodeJS version:
    node:8
  • Python version (when using a python script):
    I am using docker
  • Exact command to reproduce (include everything):

Get the package

git clone git@github.com:DeviaVir/zenbot.git

First start docker

docker-compose up

Then get backtest data

docker-compose exec server zenbot backfill binance.BTC-USDT --days 400

Here comes the strange output. trend_ema report -9.96% buy and hold gain, while srsi_macd report -5.48%. Actually, I tried many other strategies, none of them gave me the same number. I am wondering, shouldn't this number be the same from different strategies?

$ docker-compose exec  server zenbot sim  --order_type taker --strategy 'trend_ema'  --start 20170907 --end 20170913 binance.BTC-USDT --silent
(node:121) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:121) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

end balance: 1083.58544198 (8.35%)
buy hold: 900.41712033 (-9.96%)
vs. buy hold: 20.34%
210 trades over 8 days (avg 26.25 trades/day)
win/loss: 25/79
error rate: 75.96%

$ docker-compose exec  server zenbot sim  --order_type taker --strategy 'srsi_macd'  --start 20170907 --end 20170913 binance.BTC-USDT --silent
(node:104) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:104) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

end balance: 954.21165094 (-4.58%)
buy hold: 945.26200972 (-5.48%)
vs. buy hold: 0.94%
5 trades over 12 days (avg 0.41 trades/day)
win/loss: 2/1
error rate: 33.33%
  • Did I make any changes to conf-sample.js?:
c.selector = 'binance.BTC-USDT'
c.strategy = 'srsi_macd'
c.output.api.port = 17365

Describe the problem

The output buy and hold gain is different from different strategies.

Source code / Error logs

N/A

@DeviaVir
Copy link
Owner

DeviaVir commented Oct 4, 2018

Using different strategies leads to different outputs, that is by design. Am I missing some other issue here?

@moremorecoin
Copy link
Author

moremorecoin commented Oct 4, 2018

Shouldn't the buy&hold return be the same? Since I am backtesting the same date range. To my understanding, the buy&hold return is calculated by the end date market price minus start date market price, then divided by the start date market price -- which is independent of different strategies.

@stale
Copy link

stale bot commented Dec 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants