Welcome, Guest
You have to register before you can post on our site.



Search Forums

(Advanced Search)

Forum Statistics
» Members: 4,942
» Latest member: LBN
» Forum threads: 859
» Forum posts: 4,199

Full Statistics

Online Users
There are currently 81 online users.
» 1 Member(s) | 80 Guest(s)

Latest Threads
CryptoTab Browser
Forum: General Discussion
Last Post: LBN
5 minutes ago
» Replies: 0
» Views: 3
Packers And Movers Best R...
Forum: General Discussion
Last Post: zoeymalik
Yesterday, 09:56 AM
» Replies: 0
» Views: 13
Complete Gekko's datasets...
Forum: General Discussion
Last Post: fadi0811
11-12-2019, 08:05 AM
» Replies: 22
» Views: 16,560
Issue : sometimes, Gekko ...
Forum: Technical Discussion
Last Post: npuchois
11-11-2019, 06:56 PM
» Replies: 0
» Views: 27
Importing csv files to Ge...
Forum: Feature Requests
Last Post: Humpty1988
11-10-2019, 04:31 PM
» Replies: 0
» Views: 35
First Start Error module....
Forum: Technical Support
Last Post: Mieko53
11-10-2019, 04:14 AM
» Replies: 9
» Views: 5,785
An official Gekko service...
Forum: Announcements
Last Post: mambotech
11-09-2019, 02:24 PM
» Replies: 32
» Views: 32,882
Cannot read property 'tim...
Forum: Technical Support
Last Post: mambotech
11-08-2019, 06:02 PM
» Replies: 0
» Views: 37
Coinase Pro
Forum: General Discussion
Last Post: mambotech
11-08-2019, 06:05 AM
» Replies: 0
» Views: 51
Ichimoku Indicator
Forum: Strategy Development
Last Post: ardialamwijaya
11-07-2019, 04:16 AM
» Replies: 13
» Views: 13,144

Star CSV candle logging and more !!, code giveaway
Posted by: PGTART - 08-28-2019, 04:09 PM - Forum: Strategy Development - No Replies

Although things can be logged in the databases
There still a lot of people in love with spreadsheets (excel, calc, etc)
So i made a comma value logger, that can easily be integrated in your own strategies.

  • A filename is automatically generated (based upon when you started), or it can be set manual
    In the later case, previous files with such a name would be deleted.
  • It logs candles numbered with date time info, close low high  etc etc
  • If you wish you can add additional values to your log file, in the update function add them as extralog (be sure to coma seperate them).
  • And since you investigating strategies you can also optionally prefix the filename, in the refresh call.
  • Also if you like headers in your file there is an option to set them as well.

  • Different linebreaks for linux vs Windows ea \n vs \r\n\  (for the notepad users )
  • The data collumns C,D,E,F can be directly put in LibreOffice Calc stock chart !!  (they are in the right order   (code updated)
Here is my code :
which can be placed on top in your own strategies code

var fs = require('fs');
var CVCandleLogger =
    firstrun: true,
    stratname: '',
    filename: '',
    // one could log additional commma seperated info (like math results or buy sell info, using extralog)
    update: function (candle, extralog = '',stratname='') {

        if (this.filename === '') //base it upon creation time if no filename was givven
            var today = new Date();
            var dd = String(today.getDate()).padStart(2, '0');
            var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
            var yyyy = today.getFullYear();
            var hh = String(today.getHours()).padStart(2, '0');
            var mm = String(today.getMinutes()).padStart(2, '0');
            today = yyyy + '-' + mm + '-' + dd + ' ' + hh + mm;
            this.filename = stratname + ' log ' + today + '.log';

        if (this.firstrun) {
            var isWin = process.platform === "win32";
            if(isWin)this.linebreaktype='\r\n';else this.linebreaktype='\n';

            fs.access(this.filename, (err) => {
                if (!err) {
                    console.log('previous log file name existed, deleting it');
                console.log('New candle data log :', this.filename);
            this.firstrun = false;
        var moment = String(candle.start);
        var timestamp = moment.substring(0, moment.lastIndexOf(' GMT'));
        var logline = this.CandleNr+','+ timestamp + ',' + candle.open + ',' + candle.close +','+ candle.high + ',' + candle.low + ','  + candle.vwp + ',' + candle.volume + ',' + candle.trades
        if (extralog !== '') logline = logline + ',' + extralog;
        fs.appendFile(this.filename, logline, function (err) {if (err) throw err;});

    writeheader: function(extralog='',stratname='')
        if (this.filename === '') //base it upon creation time if no filename was givven
            var today = new Date();
            var dd = String(today.getDate()).padStart(2, '0');
            var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
            var yyyy = today.getFullYear();
            var hh = String(today.getHours()).padStart(2, '0');
            var mm = String(today.getMinutes()).padStart(2, '0');
            today = yyyy + '-' + mm + '-' + dd + ' ' + hh + mm;
            this.filename = stratname + ' log ' + today + '.log';
        if (this.firstrun) {
            fs.access(this.filename, (err) => {
                if (!err) {
                    console.log('previous log file name existed, deleting it');
                console.log('New candle data log :', this.filename);
            this.firstrun = false;

        logline ='CandleNr, date,time, open , close,high ,low,vwp ,volume , trades' ;
        if (extralog!=='')logline=logline+','+extralog;
        fs.appendFile(this.filename, logline, function (err) {if (err) throw err;});


if you put above code on top in your strategy just below :  var config=require('../core/util/js').getconfig();

then only one line is enough to get you started with it

    /* CHECK */
    check: function (candle) {

        CVCandleLogger.update(candle); //minimal sample  find the log outputs in your gekko folder !


oh and the function CVCandlelogger.writeheader();
can be placed in your init part of your strategy, its not required but might be handy for excel / calc.

Question how to console.log profit rate ?
Posted by: PGTART - 08-26-2019, 01:23 PM - Forum: Strategy Development - No Replies

Currently developing some improvements to bull/bear strategies.
It would be handy for debugging my code  to get the profit % to console.log when i do a short

how to get that, is it simply the previous.close and current candle close.. or does it works a bit more advanced ?.
(as that is not guaranteed to happen in real life to get it like that).

Exclamation Added dual stoploss to RSI_BULL_BEAR_ADX
Posted by: PGTART - 08-24-2019, 11:14 AM - Forum: Strategy Development - Replies (4)

I extended a known script called: RSI_BULL_BEAR_ADX

In such a way that it has two stoploss settings, one for Bull and one for Bear markets.

However now i am wondered about generic stoploss math, as in other strategies.
Most of the times i see some percentage of the last long candle close buy to not go below that.
Sometimes i see people using a stoploss with a fixed amount, say 50 dollar or so, since last long candle close.

But i'm wondered I could also code to memorize the highest and lowest candle stops - since -  my last  long bu advice.
So create a stoploss that would stop after the highest values since my last buy would drop more then a certain  percentage
I dont know enough of the background ideas behind RSI_BULL_BEAR_ADX if that would make sense or not.
And am worried if that would be an antipatten to code in regards to the ADX part of it.

What do you people think of alternative stoploss rules ?
And maybe you know of perhaps more afvanced stoploss rules ?

perhaps nice to see some logging of the not yet ready code as want validate it a bit more first :
I log to console:

Bear long at 9592 stoploss: bear<9113 bull< (misssing) // missing is bug
Bear short
Bull long at 9883 stoploss: bear<9389 bull<9834             // after each long i recalculate bot stoplosslevels so i can swing  from bear/bull markets
Bull stoploss triggered on 9775  Bullstop was 9786
Bull long at 10450 stoploss: bear<9928 bull<10398
Bull stoploss triggered on 10483  Bullstop was 10537
Bull long at  10564 stoploss: bear<10036 bull<10511
Bull stoploss triggered on 10501  Bullstop was 10511
Bull long at  10838 stoploss: bear<10296 bull<10783
Bull stoploss triggered on 10777  Bullstop was 10848   //interesting making profit from bull to bear market.
Bear long at  9673 stoploss: bear<9189 bull<(missing)
Bear short

  Possible to visualize more?
Posted by: emjayar - 08-20-2019, 01:04 PM - Forum: General Discussion - Replies (2)

Hi there,

Is it possible with the backtesting to add more graphs (e.g., indicator output) to the result window? Currently I only see the closing price plotted there, but it would be very helpful to superimpose other information on that graph.


  New arbitrage cryptocurrency bot
Posted by: Robin banks - 08-15-2019, 11:19 AM - Forum: General Discussion - No Replies

Hi I’m just wondering has anyone  heard of of **Jubilee Ace?** It is the most advanced arbitrage bot out there. No need to do arbitrage over different exchanges, they do it all within Binance. 

Anyone interested can join our discord sever!!


  How to import market
Posted by: Silent_G - 08-09-2019, 05:53 PM - Forum: Technical Discussion - No Replies

I'm new to this and just want some data to backtest some strategies. When I go to the backtest tab, I click the "Scan available data" button, this brings me to the importer tab, all well and good. But when trying to start a new import under market is completely blank, no drop downs, nothing. I didn't seem to do anything wrong in the install too can anyone help?

Question newbie set start fund and altering funds
Posted by: PGTART - 08-08-2019, 09:25 AM - Forum: General Discussion - Replies (1)

I've been testing out various strategies, and now i am wondering.
I'm at some strange fund level now, and its not realistic anymore.
Where can i set the fund back to 100 dollar or any number i provide ?.

If i would like to withdrawl some cash cash from it, say i would like to get 50 dollar back from the balance (not use it for trading anymore).
How do i tell that to gekko ?

  indicator evaluation
Posted by: rengel - 08-05-2019, 03:29 PM - Forum: Technical Discussion - No Replies

There is this special directory I heard of from certain topics on GitHub, which is about the evaluation of indicators ..\test\indicators\

I don't know how to execute the files there. How are they used/executed?

Quote:ReferenceError: describe is not defined

I would like to replicate this for other indicators, since the comparison against tulip or thelike is a good starting point, but it is nicer to reference precalculated values for other technical indicators.

Thanks in advance..

  Quick example of how to implement NATR in a strategy.
Posted by: MrBird - 08-05-2019, 12:59 AM - Forum: Guides - No Replies

Can anybody post a quick code example of how this indicators is coded in a strategy?

  What to do for bitstamp support
Posted by: Dim83fr - 08-04-2019, 12:02 PM - Forum: Bitstamp - No Replies


Can you explain what have to be done for bitstamp support. I'm ready to help, but I need a "to do/to check" list. 
New gekko structure, new gekko API, new bitstamp api, Key management modifications, ... ?
Thank you