help strategy candle
#1
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


Attached Files
.jpg   buy and sell.jpg (Size: 107.84 KB / Downloads: 11)
  Reply


Messages In This Thread
help strategy candle - by maximode - 08-03-2018, 02:40 PM

Forum Jump:


Users browsing this thread: