Use opening price for submission check for Market orders when
cheat-on-open is active
Update pnlcomm on all operations and not just profit/loss locking
Correct comment for fillalpha and add baralpha for candlestick opacity
Merge PR 378 (doc typo) PR 378 (rollover for live feeds and tz use
in datetime utilities)
Use internal dict for data feed presence test and update trade observer
There were several patches to resampling, which probably had an impact on rightedge.
Use this code as a template to achieve your desired effect.
rd = cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=5)
ret = self._old_load()
dt = self.datetime.datetime(0)
self.datetime = bt.date2num(dt - datetime.timedelta(minutes=5))
rd._old_load, rd._load = rd._load, _new_load.__get__(rd, rd.__class__)
@backtrader said in Multi timeframe indicator plotted twice and in wrong timeframe:
Use coupling: Docs - Mixing Timeframes in Indicators
This functionality allows to calculate an indicator on a timeframe an automatically apply the indicator to another lower timeframe.
I tried coupling the D1 indicator with the following code as suggested by the guide, but I still get the same error: ValueError: x and y must have same first dimension, but have shapes (54,) and (6,)
params = dict(period=30)
# self.data1 = D1 Timeframe
levels = Levels(self.data1, period=self.p.period)
self.levels = levels()
self.levels.plotinfo.subplot = False
self.levels.plotinfo.plotmaster = self.data0
I do not see any other places in the Strategy where I could couple.
The guide says
See how the () is executed with no arguments (in the background a None is being supplied). The following is happening:
pivotpoint.s1() is returning an internal LinesCoupler object which follows the rhythm of the larger scope. This coupler fills itself with the latest delivered value from the real s1 (starting with a default value of NaN)
How does the Cerebro know which timeframe is the "the larger scope"? Does it analyze all the added data?
BTW the Mixing Timeframes guide is where I started and it does not mention plotmaster at all. Maybe it could be useful for newbies if it was somehow mentioned. Just a suggestion.
I would like to get an analyzer to get overall commission in the strategy.
Tried to look into internet and manual but no luck, nearest one i find is the get_analysis but seems it does not provide such info. Not sure anyway i can do it?