Adding extra day before dtcmp calc, as otherwise the extradays
have no effect (#388)
Fixing the issue with TWS API Bust events (err code 10225) (#396)
Add support for ASK quotes for CASH assets (#395) plus fixes
Remove duplicated note (#386)
Fixing time.clock for python>=3.8 (#394)
Changed file initiation for WriterFile to make it work under
multi-process optimization (#397) plus fixes
Fixed backend loading if a backend is loaded (Google Collab) and
backend to use on MacOSX
Fix: crumb in feeds.YahooFinanceData (#400)
Fix color assignments, ticks line widths and some pep-8 improvements
Fix timeframe/compression detection when plotting
Fix default value for ticks display format on X-axis
Sample with ta-lib SAR test
Generic support of multiple "text/*" content types for Yahoo
@benjomeyer said in Timers:
Given how you pass it ... you could probably try this better
def notify_timer(self, timer, when, timername):
given that you have no additional *args or **kwargs. But a more general approach I would suggest this
def notify_timer(self, timer, when, **kwargs):
timername = kwargs.get('timername', None)
where you can also decide if a default logic for None is needed.
Note: notice the usage of elif
@backtrader said in Setting a Stop loss and target in a strategy (missing piece in a sample):
Such a sample already exists. It is ATR-Based
(Of course, it is included in the sources)
Interesting. So if I understand correctly, in the example above, it's basically an ATR trailing stop, but it just uses a self.close() so it's kind of like an invisible stop loss, instead of updating a real stop loss by cancelling the old stop order and submitting a new stop order? Both ways will work? I wonder which is recommended?
Not using it myself(have my own utility). It seems you just need to supply a ticket name (or filensme containing tickets names on each line) on command line. It will connect to the local iqfeed client by itself, download the history data and store it to the influxdb database.
I suggest you just learn the source code and see if you can use some ideas from it in you own system.
I tried with btalib to compare with original TA-Lib
params = (
#self.ma = bt.indicators.MovingAverageSimple(period=self.params.MA)
self.ma = btalib.sma(self.data.close, period=self.p.MA)
but I got this error
File "/home/learner/venv/lib/python3.8/site-packages/btalib/indicator.py", line 152, in __call__
b_init(self, *args, **kwargs)
File "/home/learner/venv/lib/python3.8/site-packages/btalib/indicators/sma.py", line 28, in __init__
self.o.sma = self.i0.rolling(window=self.p.period).mean()
File "/home/learner/venv/lib/python3.8/site-packages/btalib/meta/lines.py", line 394, in real_multifunc_op
return _MultiFunc_Op(self, *args, **kwargs)
File "/home/learner/venv/lib/python3.8/site-packages/btalib/meta/lines.py", line 306, in __init__
trailer = series[self._minidx:]
File "/home/learner/venv/lib/python3.8/site-packages/backtrader/linebuffer.py", line 163, in __getitem__
return self.array[self.idx + ago]
TypeError: unsupported operand type(s) for +: 'int' and 'slice'
The code with original TA-Lib runs normally. But I don't understand what the error with btalib. Please explain for new rookies!