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
I have two strategies that I'd like to run sequentially. The first strategy allocates a portion of the portfolio between its assets (using self.order_target_percent) and the second strategy uses what remains of the portfolio.
What is the best way in backtrader to achieve the above?
@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?