How to retrieve candle size for strategy
#1
I would like to make my strategies less depent on time intervals.
EA a max price swing between 5 minutes is statistically smaller then with 60 minute candles.

So when i use constants in my math i'd like to scale them by a factor of candle size  ea :

candlesize
-------------   *   constant
60

How can  i retrieve  candlesize inside the strategy ?
  Reply
#2
Hi Peter,

you can do this with the help of the tradingAdvisor.


Code:
var config = require ('../core/util.js').getConfig();

 this.requiredHistory     = config.tradingAdvisor.historySize;
 this.setCandleSize    = config.tradingAdvisor.candleSize;
 console.log("candleSize: "+this.setCandleSize+", history: "+this.requiredHistory);


Another way to use the different candle sizes similar to the way you worked with different periods of the same indicator before, you could do a multiple timeframe approach. There are strategies incorporating this approach here on this forum.

Regards,
Rainer
  Reply
#3
(09-10-2019, 09:39 AM)rengel Wrote: Hi Peter,

you can do this with the help of the tradingAdvisor.


Code:
var config = require ('../core/util.js').getConfig();

 this.requiredHistory     = config.tradingAdvisor.historySize;
 this.setCandleSize    = config.tradingAdvisor.candleSize;
 console.log("candleSize: "+this.setCandleSize+", history: "+this.requiredHistory);


Another way to use the different candle sizes similar to the way you worked with different periods of the same indicator before, you could do a multiple timeframe approach. There are strategies incorporating this approach here on this forum.

Regards,
Rainer

Thanks !!!,
I understand how to add candles, its rather though for margin differences i'd like to use it for. (like in math related to distances from indicator results)
 
Maybe do you also know how to set the start trading amount to a fixed number (start with 1000 coins) and retrieve the real trade profit result after a short ?.
  Reply


Forum Jump:


Users browsing this thread: