Gekko Forum
help strategy candle - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Strategy Development (https://forum.gekko.wizb.it/forum-12.html)
+--- Thread: help strategy candle (/thread-57498.html)



help strategy candle - maximode - 08-03-2018

I'm trying to make a strategy that buys and sells but I can not get it to work well, I thought of many strategies ...
I admit that I have very little knowledge in programming Sad

I would like you to do the following or the closest thing, taking advantage of each upload (see attached)

the idea is that you buy and sell according to a percentage X or amount that I define


this is my code:


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

// Let's create our own strat
var strat = {};

// Prepare everything our method needs
strat.init = function() {
this.input = 'candle';
this.currentTrend = 'neutral';
this.requiredHistory = 0;

this.percentUpper = this.settings.percentUpper;
this.percentLower = this.settings.percentLower;
}

// Based on the newly calculated
// information, check if we should
// update or not.
strat.check = function(candle)
{
if (candle.close >= candle.close + ( candle.close*( this.percentLower/100.0 )))

{

this.advice('short');
log.debug(" " );
}
if (candle.close <= candle.close - ( candle.close*( this.percentUpper/100.0)))
{
this.advice('long');
log.debug(" " );
}
}

module.exports = strat;

recomendation??  Huh

Thank you