Code help (time plus)
Hi all

i want my cli to report when the next candle will trigger i.e 

Next candle time: (date and time)

I have the code to report current time how do i get it to report that time plus my candle size of 4 hrs?

Code:'\t Next Candle Update:', this.marketTime.format('YYYY-MM-DD HH:mm:ss'))

All help welcome please
NOTE: usually I calculate these kind of metrics in the UI (unfortunately not this one), but for the sake of explaining Gekko and hacking this in there we'll do it directly in the plugin itself:

I'm not sure where that code is logging, but you'll need 2 pieces of information:

- current time (you already have that as marketTime)
- last 4hour candle time

The second one is only available in code very close to your strategy as the rest of Gekko does not care about 4 hour candles. Though the code close to your strategy does not have easy access to that "marketTime", but it does have access to a small 1 minute candle.

So instead what I would do is open up this file:

And add some new code in 2 places, something like this:

NOTE2: Technically speaking doing this is fine if you are playing around, but this is not a good way from a developing point of view: right now it always assumes 4 hour candles and it's logging directly in core plugins. A better way would be creating a plugin that listens to candle events and calculates this dynamically, but in a way where it can be plugged in and out of gekko without editing any core files.
HI Mike,

thank you for the detailed reply, i appreciate your time, my coding knowledge isnt great and i dont want to break something and have to start again. I see you point especially in light of your current development work would mean any git pull i do would reset the code each time.

Its not so important to me to have this it was more of a nice to have than an actual requirement.

Thanks again
No problem Smile I love explaining to people how Gekko works. I posted a bit more text so that there is something to read if anyone stumbles across this thread in the future.

Quote:Its not so important to me to have this it was more of a nice to have than an actual requirement.

I actually think this is a great addition for the UI, will put it on my todo!

Forum Jump:

Users browsing this thread: