Coder Social home page Coder Social logo

gekko-strategies's Introduction

Gekko-Strategies

A list of strategies I written up for the Gekko Trading Bot. These strategies are for educational purposes only! I do not know if they are profitable. As always, you should fully understand any strategy you use with the Gekko trading bot as you are responsible for the trades the bot makes for you.

Candlesticks - A strategy that doesn't buy/sell, only tells you what candlestick pattern is when it closes.

Fibonacci Trendlines - A trading strategy that buys when 8 day and 21 day EMA is below the 55 day EMA and sell when the 8 day and 21 day is above the 55.

MACD Momentum - A trading strategy that tries to catch the bottom of the MACD curve and exits when MACD falls below 0. It is a WIP strategy and the code is extremely buggy (I gave up on perfecting when I saw how elegant the RSI Bull Bear strategy is) so it really should be use for references only.

StepGains - My first strategy. It buys on a dip and sell when there is a 1% gain. The variables are hard coded so you can't change it in the UI.

gekko-strategies's People

Contributors

crypto49er avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gekko-strategies's Issues

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?

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)

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?

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) ??

instructions

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

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.