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

less candles when using talib and candleSize < 0.5 * batchSize #2522

Closed
pangoyal opened this issue Sep 12, 2018 · 5 comments · Fixed by #2533
Closed

less candles when using talib and candleSize < 0.5 * batchSize #2522

pangoyal opened this issue Sep 12, 2018 · 5 comments · Fixed by #2533

Comments

@pangoyal
Copy link

pangoyal commented Sep 12, 2018

I'm submitting a ...
[x] bug report
[ ] question about the decisions made in the repository

Action taken (what you did)
Talib indicator added and candle size < 0.5 * batchSize

Expected result (what you hoped would happen)
The total number of candles executed should be as per the time period and candle size. eg. 60 candles in 1 hour

Actual result (unexpected outcome)
Less than expected candles are executed. eg.

Strategy run duration = 24 hours, batchSize = 50, candleSize = 30. Expected candles = 48, Actual = 48
Strategy run duration = 24 hours, batchSize = 50, candleSize = 20. Expected candles = 72, Actual = 59
Strategy run duration = 24 hours, batchSize = 50, candleSize = 10. Expected candles = 144, Actual = 59
Strategy run duration = 24 hours, batchSize = 40, candleSize = 10. Expected candles = 144, Actual = 75
Strategy run duration = 24 hours, batchSize = 20, candleSize = 10. Expected candles = 144, Actual = 144

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)
Gekko v0.6.6
macOS 10.13.6 (17G65)

@askmike
Copy link
Owner

askmike commented Sep 13, 2018

Can you provide a reproducable test case? eg your strategy and logging code

@elvisrene
Copy link

elvisrene commented Sep 13, 2018 via email

@pangoyal
Copy link
Author

pangoyal commented Sep 14, 2018

Strategy

var strat = {};

strat.init = function () {
  this.addTalibIndicator('mom', 'mom', { optInTimePeriod: 10 });
  this.count = 0;
}
strat.check = function (candle) {
    console.log(this.count++);
}

module.exports = strat;

config:

config.tradingAdvisor = {
  enabled: true,
  method: 'test',
  candleSize: 15,
  historySize: 150
}
config.backtest = {
  //daterange: 'scan',
  daterange: {
   from: "2018-05-14 00:00:00",
   to: "2018-05-14 01:00:00"
  },
  batchSize: 50
}

Output:
0
1
2
3

@askmike
Copy link
Owner

askmike commented Sep 16, 2018

Thanks for the report! I was able to reproduce and pushed a fix, could you download the develop branch and let me know if that solves it? If it doesn't please comment here.

@pangoyal
Copy link
Author

It works now. Thanks Mike.

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

Successfully merging a pull request may close this issue.

3 participants