Code help (time plus)
#2
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: https://github.com/askmike/gekko/blob/21...Advisor.js

And add some new code in 2 places, something like this: https://www.diffchecker.com/XZaWue3I

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.
  Reply


Messages In This Thread
Code help (time plus) - by Kris191 - 07-25-2018, 11:05 AM
RE: Code help (time plus) - by askmike - 07-26-2018, 01:42 AM
RE: Code help (time plus) - by Kris191 - 07-26-2018, 05:51 AM
RE: Code help (time plus) - by askmike - 07-26-2018, 10:35 AM

Forum Jump:


Users browsing this thread: