Coder Social home page Coder Social logo

gekko-strategies's Issues

instructions

Could you give instructions for setting up and running? Your videos are great but no clue how to get your strategies in gekko.

Editted Stepgains

Hello,

I editted your file "stepgains" with the main that he buys at 0.99% of the current price and that he than sells at the buyPrice * 1.01. Do you know that's wrong with my code? If i backtest the code gekko doesn't do any trade.

// helpers
var _ = require('lodash');
var log = require('../core/log.js');
var buyPrice = 0.0;
var sellPrice = 0.0;
var advised = false;

// Let's create our own buy and sell strategy 
var strat = {};

// Prepare everything our strat needs
strat.init = function() {
    // how many candles do we need as a base
  // before we can start giving advice?
  this.requiredHistory = this.tradingAdvisor.historySize;
}

// What happens on every new candle?
strat.update = function(candle) {
  // Display close price in terminal
  log.debug('candle time', candle.start);
  log.debug('candle close price:', candle.close);
}

// For debugging purposes.
strat.log = function() {

}

// Based on the newly calculated
// information, check if we should
// update or not.
strat.check = function(candle) {

    if(buyPrice == 0){
        buyPrice = candle.close * 0.99;
    }
    if(candle.close <= buyPrice && !advised){
        this.advice("long");
        log.debug('Buying at', candle.close);
        sellPrice = candle.close * 1.01;
        advised = true;
    }
    if(candle.close >= sellPrice && buyPrice != 0){
        this.advice("short");
        log.debug('Selling at', candle.close);
        buyPrice = 0;
        sellPrice = 0;
        advised = false;
    }
}

module.exports = strat;

Is this maybe an error in the backtest program?

Issue Uncaught Exception

uncaughtException { TypeError: log.remote is not a function
at Base.strat.update (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\strategies\RSICandle.js:73:9)
at Base.bound [as update] (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at Base.propogateTick (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\tradingAdvisor\baseTradingMethod.js:136:8)
at Base.bound [as propogateTick] (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at Base.calculateSyncIndicators (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\tradingAdvisor\baseTradingMethod.js:129:8)
at Base.bound [as calculateSyncIndicators] (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at afterAsync (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\tradingAdvisor\baseTradingMethod.js:94:10)
at Base.tick (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\tradingAdvisor\baseTradingMethod.js:108:5)
at Base.bound [as tick] (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at Actor.emitStratCandle (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\tradingAdvisor\tradingAdvisor.js:103:17)
--> in Database#all('\n SELECT * from candles_USDT_BTC\n WHERE start <= 1553806319 AND start >= 1553803320\n ORDER BY start ASC\n ', [Function])
at Reader.get (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\sqlite\reader.js:98:11)
at Reader.bound [as get] (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at Market.get (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\core\markets\backtest.js:61:15)
at Market.bound [as get] (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at Market.processCandles (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\core\markets\backtest.js:105:10)
at bound (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\lodash\dist\lodash.js:729:21)
at Statement. (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\plugins\sqlite\reader.js:108:5) __augmented: true }
xxx POST /api/backtest 500 5,948ms -

Error: non-error thrown: [object Object]
at Object.onerror (C:\Users\Win10\Downloads\gekko-develop\gekko-develop\node_modules\koa\lib\context.js:105:40)
at process._tickCallback (internal/process/next_tick.js:68:7)

StepGains

Hi,

Thanks for all the vids, just wondering if you have the updated StepGains from the second youtube vid?

Thanks

candelsticks.js question

so i have your candelstick working at least when it comes to it piping out what the candle is but i am having a hard time finding out how to actually create a trade based on it. What code actually creates a trade in gekko?

Bug found in candlestick

I noted the the lastTreeTrend never got updated, you forgot to use .closed for the last element
so candles[8].close instead of candles[8], the same for candles[6]

So your fixed code would become (around line 76) :

if (candleLength < largestCandle.length * 0.25) {

  if (candles[6].close <= candles[7].close && candles[7].close <= candles[8].close) {
    lastThreeTrend = 'up';
  }
  if (candles[8].close <= candles[7].close && candles[7].close <= candles[6].close) {
    lastThreeTrend = 'down';
  }

Another bug or at least strange code detail that you might explain
Why do you use the 6,7,8 and not the header candles (ea the last 3 new candles) ??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.