CLI vs UI results difference. - mutenroch - 09-14-2018
Hi,
I've been comparing command line and UI bactest results and there are quite big diferences between them as you can see in the attached images.
cli backtests result claims a -1% while Ui result is a -12%. Can't see why since both performs the same strat/indicator/config files, market data and date range.
Anyone experienced this?
thanks¡
RE: CLI vs UI results difference. - askmike - 09-15-2018
Can you share the strategy and the market? I like to reproduce this.
RE: CLI vs UI results difference. - mutenroch - 09-15-2018
(09-15-2018, 04:10 AM)askmike Wrote: Can you share the strategy and the market? I like to reproduce this.
For sure!
in the config.js just modified the market/currency/asset and removed the strat settings block as they are fixed in the indicator .js
The market.db is too big to be uploaded (as said in a promp) what can I do?
strategy:
Code: // mutenroch_rev2
// helpers
var _ = require('lodash');
var log = require('../core/log.js');
// let's create our own method
var method = {};
// prepare everything our method needs
method.init = function() {
// keep state if adviced or not
this.adviced = false;
// how many candles do we need as a base
// before we can start giving advice?
this.requiredHistory = this.tradingAdvisor.historySize;
// define the indicators we need
this.addIndicator('psar', 'PSAR', this.settings);
}
// what happens on every new candle?
method.update = function(candle) {
// nothing!
}
method.check = function(candle) {
this.bull = this.indicators.psar.bull;
if(this.bull) {
console.log('Bull:', this.bull, 'PSAR res:', this.indicators.psar.result, 'Close:', candle.close);
if(this.adviced == false){
// new uptrend detected
this.advice('long');
this.adviced = true;
}else
this.advice();
} else {
if(this.adviced == true){
// new downtrend detected
this.advice('short');
this.adviced = false;
}else
this.advice();
}
}
module.exports = method;
indicator:
Code: var Indicator = function(settings) {
this.input = 'candle';
this.acceleration = 0.02;
//this.acceleration = settings.optInAcceleration;
this.maximum = 0.2;
//this.maximum = settings.optInMaximum;
this.result = 0;
this.bull = true;
this.start = 0.02;
//this.start = settings.optInStart;
}
Indicator.prototype.update = function(candle) {
if(this.result == 0) {
this.result = candle.close;
this.low1 = candle.low;
this.high1 = candle.high;
this.low2 = candle.low;
this.high2 = candle.high;
this.hp = candle.high;
this.lp = candle.low;
this.af = this.start;
return;
}
if(this.bull){
this.psar = this.result + this.af * (this.hp - this.result)
} else {
this.psar = this.result + this.af * (this.lp - this.result)
}
let reverse = false;
if(this.bull){
if(candle.low < this.psar){
this.bull = false;
reverse = true;
this.psar = this.hp;
this.lp = candle.low;
this.af = this.start;
}
} else {
if(candle.high > this.psar){
this.bull = true;
reverse = true;
this.psar = this.lp;
this.hp = candle.high;
this.af = this.start;
}
}
if(!reverse){
if(this.bull){
if(candle.high > this.hp){
this.hp = candle.high;
this.af = Math.min(this.af + this.acceleration, this.maximum);
}
if(this.low1 < this.psar)
this.psar = this.low1;
if(this.low2 < this.psar)
this.psar = this.low2;
} else {
if(candle.low < this.lp){
this.lp = candle.low;
this.af = Math.min(this.af + this.acceleration, this.maximum);
}
if(this.high1 > this.psar)
this.psar = this.high1;
if(this.high2 > this.psar)
this.psar = this.high2;
}
}
this.low2 = this.low1;
this.low1 = candle.low;
this.high2 = this.high1;
this.high1 = candle.high;
this.result = this.psar;
}
module.exports = Indicator;
thanks!
RE: CLI vs UI results difference. - askmike - 09-16-2018
Quote:The market.db is too big to be uploaded (as said in a promp) what can I do?
Can you let me now the market you experienced this on?
A quick question: Are you sure the paperTrader is configured exactly the same (in the UI as well as in your CLI config)?
RE: CLI vs UI results difference. - mutenroch - 09-16-2018
(09-16-2018, 04:48 AM)askmike Wrote: Quote:The market.db is too big to be uploaded (as said in a promp) what can I do?
Can you let me now the market you experienced this on?
A quick question: Are you sure the paperTrader is configured exactly the same (in the UI as well as in your CLI config)?
Sorry Mike, no, they are not. default maker fee was different. sorry again
RE: CLI vs UI results difference. - askmike - 09-17-2018
No problem! I think a good lesson to take away from this is that it's not very clear and intuitive what settings play a role in a backtest.
Working on that as we speak with the new UI!
RE: CLI vs UI results difference. - mutenroch - 09-17-2018
Thank you! Would be difficult to make the iu to update a config file in local gekko folder, config_iu so to speak, with its settings so we could run cli to check things in parallel straight forward? It is not a live or die matter and you are really busy, we know, its just a thought.
|