Ichimoku Indicator
#12
(05-29-2018, 02:42 AM)PatTrends Wrote: Put  

Code:
var strat = {};

above

Code:
strat.init = function(){...

Thank you but again I'm facing another error:

Code:
 <-- POST /api/backtest
2018-05-29 23:16:10 (INFO):    Setting up Gekko in backtest mode
2018-05-29 23:16:10 (INFO):    
2018-05-29 23:16:10 (INFO):    Setting up:
2018-05-29 23:16:10 (INFO):         Trading Advisor
2018-05-29 23:16:10 (INFO):         Calculate trading advice
2018-05-29 23:16:10 (INFO):         Using the strategy: ICHIMOKU
 xxx POST /api/backtest 500 2,041ms -

 Error: non-error thrown: Child process has died.
     at Object.onerror (/home/full/gekko/node_modules/koa/lib/context.js:105:40)
     at process._tickCallback (internal/process/next_tick.js:109:7)

This seems more tricky, cause it is not well explained.
Could you please help me another time?

Thank you!

my code:
Code:
var log = require('../core/log.js');

var strat = {};

strat.init = function(){
// Add Ichimoku Indicator
this.addIndicator('ichimoku', 'ICHIMOKU');
}

strat.check = function(){
var ichimoku = this.indicators.ichimoku;

//ICHIMOKU INDICATOR
log.debug('ICHIMOKU INDICATOR');
log.debug('tenkan:', ichimoku.tenkan);
log.debug('kijun:', ichimoku.kijun);
log.debug('senkouSpanA:', ichimoku.senkouSpanA);
log.debug('senkouSpanB :', ichimoku.senkouSpanB );
log.debug('------------------------------------------');

}



--------------------------------------------------------------------------------------


/*
Ichimoku Indicator ../strategies/indicators/ICHIMOKU.js
*/

var Indicator = function(){
this.input = 'candle';
this.highs = new Array(52);
this.lows = new Array(52);
this.age = 0;

this.tenkan = null;
this.kijun = null;
this.senkouSpanA = null;
this.senkouSpanB = null;
}

Indicator.prototype.update = function(candle) {
this.highs.push(candle.high);
this.lows.push(candle.low);
this.age++

if(this.age >= 52){
// Calc
this.tenkan = ( Math.max(...this.highs.slice(-9)) + Math.min(...this.lows.slice(-9)) ) / 2;
this.kijun = ( Math.max(...this.highs.slice(-26)) + Math.min(...this.lows.slice(-26)) ) / 2;
this.senkouSpanA = (this.tenkan + this.kijun) / 2;
this.senkouSpanB = ( Math.max(...this.highs.slice(-52)) + Math.min(...this.lows.slice(-52)) ) / 2;
}
}

module.exports = Indicator;
  Reply


Messages In This Thread
Ichimoku Indicator - by PatTrends - 02-28-2018, 10:18 PM
RE: Ichimoku Indicator - by PatTrends - 03-01-2018, 02:12 PM
RE: Ichimoku Indicator - by Fizcko - 03-01-2018, 05:01 PM
RE: Ichimoku Indicator - by muditgrover - 03-09-2018, 09:20 AM
RE: Ichimoku Indicator - by edoe - 03-10-2018, 06:09 AM
RE: Ichimoku Indicator - by PatTrends - 03-03-2018, 08:00 PM
RE: Ichimoku Indicator - by riesgo.rafael - 03-13-2018, 01:51 AM
RE: Ichimoku Indicator - by Kris191 - 03-14-2018, 05:15 AM
RE: Ichimoku Indicator - by PatTrends - 03-20-2018, 09:36 PM
RE: Ichimoku Indicator - by palofug87 - 05-27-2018, 04:19 PM
RE: Ichimoku Indicator - by PatTrends - 05-29-2018, 02:42 AM
RE: Ichimoku Indicator - by palofug87 - 05-29-2018, 09:19 PM
RE: Ichimoku Indicator - by PatTrends - 05-31-2018, 06:44 PM
RE: Ichimoku Indicator - by ardialamwijaya - 11-07-2019, 04:16 AM

Forum Jump:


Users browsing this thread: