Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Dynamic behavior #868

Closed
raffus opened this issue Jul 21, 2017 · 2 comments
Closed

Dynamic behavior #868

raffus opened this issue Jul 21, 2017 · 2 comments

Comments

@raffus
Copy link
Contributor

raffus commented Jul 21, 2017

Hi there,

I was wondering if would it be possible to make Gekko work in a more dynamic way.

What I mean is, in case my strategy sees a trend, then make gekko change config.tradeAdvisor params.

For example:

if(this.myTrend == "up")
{
	{ ... }
	config.tradingAdvisor = {
		candleSize: 240
  	}
}
else if(this.myTrend == "down") {
	{ ... }
	config.tradingAdvisor = {
		candleSize: 60
  	}
}

then having gekko working in a different way.

Any tip about this?

BR,
R

@thegamecat
Copy link

it is actually possible to do this in a strategy so long as the config candle size is lower than the values you want to use.

You can create new time based candles yourself so long as you have a talib indicator referenced, then the candle history is available to manipulate.

@askmike
Copy link
Owner

askmike commented Jul 23, 2017

As @thegamecat says it is possible, but very hard at the moment:

When you use this.addIndicator in your strategy Gekko will do a lot of dirty work for you behind the scene: initialising a new indicator, feeding it market data, calculating results, making sure no async race conditions happen (see #837). Right now if you use these functions you are limited to a single timeframe (the one specified in config.tradingAdvisor), but you are free to manually manage all of this and import the indicators directly.

Here is some more background information.


Unless you really know what you are doing, multi timeframe is unsupported for now. Keep in mind that instead of adjusting candleSizes (from 5 min to 20 min) you can also require an indicator result to be a certain value at least 4 candles - which results in a very similar signalling.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants