I've read the docs, which suggest just passing in csv=True to the indicator will output the indicator values, but that results in an error: TypeError: init() got an unexpected keyword argument 'csv'. Indicator is working, and csv writing is working (w/o indicator values).
Best posts made by cemdev
-
Adding custom indicator values to csv writer output
Latest posts made by cemdev
-
RE: error resampling data
thank you! i modified strategy.py with that change and it works now. your support is amazing.
-
error resampling data
I have a 15m bar feed, which I am resampling to 1hr and 2hr bars - works fine. But when I change the 2hr bar to resample to daily I get this error:
File "/home/chris/anaconda3/lib/python3.6/site-packages/backtrader/strategy.py", line 424, in getwritervalues
values.extend([''] * iocsv.lines.isize())
AttributeError: 'Lines_LineSeries_LineIterator_DataAccessor_Indicat' object has no attribute 'isize'I am writing to csv, but it doesn't seem to be related because the error continues even if i disable csv output for that datafeed. Not really sure where to start with this one?
data = btfeeds.GenericCSVData( dataname=datafilepath, fromdate=datetime.datetime(2016, 1, 1), todate=datetime.datetime.now(), timeframe=bt.TimeFrame.Seconds, compression=candlestick_period, nullvalue=0.0, dtformat=('%Y-%m-%d %H:%M:%S'), datetime=2, high=3, low=4, open=5, close=1, volume=6, openinterest=-1 ) cerebro.adddata(data, name=x) cerebro.resampledata(data, name=x + "_hour", timeframe=bt.TimeFrame.Minutes, compression=60) cerebro.resampledata(data, name=x + "_daily", timeframe=bt.TimeFrame.Minutes, compression=60*24)
Note, TimeFrame.Daily, compression=1 does the same thing. Just tried this to see. Everything up to 8hours works fine. After 8, I get this error.
-
RE: skip plotting for resampled data?
Ah, okay, that does work, thanks. Still getting to grips with the architecture.
-
RE: skip plotting for resampled data?
sorry, that doesn't help, unless i'm reading the docs wrong. i can show/hide lines on indicators - but i don't know how to not plot the price chart itself for resampled data. in the docs it says plotscheme is system-wide - i want to control this on a dataset level.
-
RE: skip plotting for resampled data?
although - in a perfect world i would still like to plot a couple of the indicators on resampled data, just not the price chart itself. or, if there is a way to shrink the height of the price chart to close to zero (selectively per dataset) that would work too.
-
skip plotting for resampled data?
I'm running tests that work on multiple timeframes, but really don't need to see multiple charts when plotting, just makes the chart i am interested in too small. read the docs - can't see how to turn off plotting for resampledata ?
-
RE: Adding custom indicator values to csv writer output
devil's in the details i suppose. thanks for that, that works.
-
Adding custom indicator values to csv writer output
I've read the docs, which suggest just passing in csv=True to the indicator will output the indicator values, but that results in an error: TypeError: init() got an unexpected keyword argument 'csv'. Indicator is working, and csv writing is working (w/o indicator values).
-
RE: execute against 2 (or more) different data sets
yes, all working. what i wanted was just to add 2 symbols and have the strategy execute against both of them (independently) - but I see how it's more flexible and powerful this way.
-
RE: execute against 2 (or more) different data sets
okay, i see they get added as new data feeds, which makes sense. not what i wanted, but i'll just execute twice, no problem.