Interactive backtrading
-
Hi,
I would like to have a user-interactive strategy, where the user can confirm buy/sell signals. Technically this is possible in the console by using Python input() everytime. However, I'd rather show the user a chart of the data to aid the user decision.Ideally, it would be possible to use cerebros plot function from within the strategy, but I fear this may not be possible (certainly it is not intended).
Alternatively I consider coding a separate GUI (using QT/ pyqtgraph for example) that interacts with the strategy. I would like to reuse as much as possible from backtraders functionality.
Generally, does anyone have experience with backtrader and 'interactive' backtrading?
Thanks!
-
The closest topic I remember seeing on this forum was a discussion about live chart support .
Probably you may find some useful ideas there.
-
Just figured out a simple solution that uses backtraders functionality quite well:
plotter = bt.plot.plot.Plot() rfig = plotter.plot(self, figid=0, numfigs=1, iplot=True, start=0, end=len(self.data)) plotter.show()
within next() of strategy. This plots all the data seen so far.
-
@vladisld said in Interactive backtrading:
The closest topic I remember seeing on this forum was a discussion about live chart support .
Probably you may find some useful ideas there.
Great, thanks. :) Charts with live data can be a next step.