Looking for simple buy/sell at certain amount strategy
#1
Hi folks,

I am looking for a simple buy at a certain price / sell at a certain price Startegy, offering a coffee for a solution  Big Grin
  Reply
#2
https://github.com/xFFFFF/Gekko-Strategies

look in there might be something you can work with
  Reply
#3
Kris thanks. Unfortunately there's just a strategy with a certain procentage and not a certain price
  Reply
#4
hi , i'm looking for some like that too.
i would like to have a simple strategy that buy when the price is at the price i set and put a stop loss automatically as it buy

example:

i want to buy LTC at 60 $ .

when the price will be 60$ gekko buy it and automatically put a stop loss at 59$ or a percentual less or else the position stay open or sell at the price i will set

i'm no coder , i'm usig gekko for a while i tryed few strategies but i would like to create some simple like that. i found the buyat sellat strategiy very interesting but not able to modified that Sad

thanks for helping
  Reply
#5
just found out this:

// Source: https://raw.githubusercontent.com/impera...IXPRICE.js
// Downloaded from: https://github.com/xFFFFF/Gekko-Strategies
// helpers
var _ = require('lodash');
var log = require('../core/log.js');

// configuration
var config = require('../core/util.js').getConfig();
var settings = config.FIXPRICE;

// let's create our own method
var method = {};

// prepare everything our method needs
method.init = function() {
this.name = 'FIXPRICE';

this.currentTrend;
this.requiredHistory = 0;

if (settings.exit === undefined) {
settings.exit = -1;
}

log.debug('New FIXPRICE', settings);
}

// what happens on every new candle?
method.update = function(candle) {
// nothing!
}

// for debugging purposes: log the last calculated
// EMAs and diff.
method.log = function() {

}

method.check = function(candle) {
var price = candle.close;

var message = '@' + price.toFixed(5) + ' (long:' + settings.long.toFixed(5) + ' short: '+ settings.short.toFixed(5) +')';
if(price <= settings.exit) {

this.advice('exit');
} else if(price <= settings.long) {
//log.debug('long', message);

if(this.currentTrend !== 'up') {
this.currentTrend = 'up';
log.debug('long advice', message);
this.advice('long');
} else
this.advice();

} else if(price >= settings.short) {
//log.debug('short', message);

if(this.currentTrend !== 'down') {
this.currentTrend = 'down';
log.debug('short advice', message);
this.advice('short');
} else
this.advice();

} else {
log.debug('we are currently not in a long or short advice', message);
this.advice();
}
}

module.exports = method;


could be working. i tested but stop loss doesn't work (exit variable)
anyone can help?
  Reply
#6
(08-08-2018, 04:50 AM)Garem Wrote: Hi folks,

I am looking for a simple buy at a certain price / sell at a certain price Startegy, offering a coffee for a solution  Big Grin

https://github.com/TeoWay/Gekko-Strategies
Wrote a few days ago, my first. I did not think that anyone could need it, except me. Have a good idea where it can be useful?
  Reply
#7
@Teo,

Your solution looks solid. Is there anyway to set prices from .toml file ?
  Reply
#8
Of course, you can set your own buy and sale prices in the .toml file or in a gekko itself.

The strategy makes buying or selling at set prices or better. It also have a debug mode, where you can see exactly executed prices. Just set debug to true in .js file, run backtest in gekko and look at console screen where you was started the gekko.
  Reply
#9
great job man. i will give it a try right now.
thanks
  Reply
#10
(08-30-2018, 06:52 AM)Teo Wrote: Of course, you can set your own buy and sale prices in the .toml file or in a gekko itself.

The strategy makes buying or selling at set prices or better. It also have a debug mode, where you can see exactly executed prices. Just set debug to true in .js file, run backtest in gekko and look at console screen where you was started the gekko.

Thanks Teo this is really useful. Is it easy to introduce a new variable that would execute sell1 if the price goes over by a certain amount? But then also execute buy again if the price is less than a certain amount of the previous sell1??
  Reply


Forum Jump:


Users browsing this thread: