askmike / gekko

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

solving problem with EMA indicator code #2770

Closed federicorojas11 closed 5 years ago

federicorojas11 commented 5 years ago

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

Hi evearybody.

I want to use the EMA and the DEMA indicators. They run, but I cant made them make any trade on backtesting.

I tried running gekko on backtesting mode from bash, but the console log says 'undefined' on both indicators. Anyway, the console log for the candle is ok. So i think that the problem is something about the strategy code...

When i use the 'EMA' indicator on a 'TestingStrategy.js' using the tulip library, the result is undefined.

Here is the code i'm using:


var strat = {};

strat.init = function() {

this.addTulipIndicator('ema11','ema',{optInTimePeriod: 10});
this.addTulipIndicator('dema11','dema',{optInTimePeriod: 10});
}

strat.check = function(candle) {

console.log(this.TulipIndicator); console.log(candle); }

module.exports = strat;


and when i run node gekko --backtest --config config.js



/ \ / |/ | / |/ | / | / \ /$$$$$$ |$$$$$$$$/ $$ | /$$/ $$ | /$$/ /$$$$$$ | $$ | $$/ $$ | $$ |/$$/ $$ |/$$/ $$ | $$ | $$ |/ |$$ | $$ $$< $$ $$< $$ | $$ | $$ |$$$$ |$$$$$/ $$$$$ \ $$$$$ \ $$ | $$ | $$ \$$ |$$ |____ $$ |$$ \ $$ |$$ \ $$ __$$ | $$ $$/ $$ |$$ | $$ |$$ | $$ |$$ $$/ $$$$$$/ $$$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/

    Gekko v0.6.8
    I'm gonna make you rich, Bud Fox.

2019-04-30 14:22:14 (INFO): Setting up Gekko in backtest mode 2019-04-30 14:22:14 (INFO): 2019-04-30 14:22:14 (WARN): The plugin Candle writer does not support the mo de backtest. It has been disabled. 2019-04-30 14:22:14 (INFO): Setting up: 2019-04-30 14:22:14 (INFO): Trading Advisor 2019-04-30 14:22:14 (INFO): Calculate trading advice 2019-04-30 14:22:14 (INFO): Using the strategy: TestingStrategy 2019-04-30 14:22:15 (INFO):

2019-04-30 14:22:15 (INFO): Setting up: 2019-04-30 14:22:15 (INFO): Paper Trader 2019-04-30 14:22:15 (INFO): Paper trader that simulates fake trades . 2019-04-30 14:22:15 (INFO):

2019-04-30 14:22:15 (INFO): Setting up: 2019-04-30 14:22:15 (INFO): Performance Analyzer 2019-04-30 14:22:15 (INFO): Analyzes performances of trades 2019-04-30 14:22:15 (INFO):

2019-04-30 14:22:15 (INFO): Scanning local history for backtestable daterang es. 2019-04-30 14:22:15 (DEBUG): Available 165599 2019-04-30 14:22:15 (DEBUG): Optimal 165598 2019-04-30 14:22:15 (INFO): Gekko is able to fully use the local history. 2019-04-30 14:22:15 (INFO): Gekko was able to find a single daterange in the locally stored history: 2019-04-30 14:22:15 (INFO): from: 2019-01-01 17:52:00 2019-04-30 14:22:15 (INFO): to: 2019-04-26 17:50:00

2019-04-30 14:22:15 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPE R TESTING 2019-04-30 14:22:15 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OW N RISK!

undefined { start: moment("2019-01-25T14:52:00.000"), open: 0.00001195, high: 0.00001198, low: 0.00001185, close: 0.00001191, vwp: 0.000011919606816129541, volume: 38226797, trades: 8077 } (node:14968) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated undefined { start: moment("2019-01-26T14:52:00.000"), open: 0.00001191, high: 0.00001194, low: 0.00001149, close: 0.00001159, vwp: 0.00001168789619400708, volume: 73417977, trades: 14176 } undefined

etc......


Can you please help me...? I really want to use these indicators in my strategies. Sorry about my english... Thanks! :D

askmike commented 5 years ago

Hey,

This is the issue tracker for tracking bugs and new features. Your issue is not a bug report. Please ask around on the forum, stack overflow, discord or telegram next time. See here: https://gekko.wizb.it/docs/introduction/getting_help.html

As for your issue:

console.log(this.TulipIndicator);

There is no such thing as this.TulipIndicator, please check the docs for the correct way of accessing calculated indicator results.