backtesting.py icon indicating copy to clipboard operation
backtesting.py copied to clipboard

How to plot enter trade events

Open romanbsd opened this issue 3 years ago • 1 comments

Sorry if I missed it in the documentation, but how one plots the trade events (long or short)? It's hard to understand from the candlestick chart when exactly the position was opened (the beginning of the dashed line). Thanks!

romanbsd avatar Aug 10 '22 13:08 romanbsd

There are only trade exits on the P/L triangles plot.

I considered adding a gray line extending from trade entry to its exit triangle (I thought I uploaded an example image somewhere on the forum, but now I can't find it), but that has yet to manifest.

The relevant code is to be added here: https://github.com/kernc/backtesting.py/blob/65f54f6819cac5f36fd94ebf0377644c62b4ee3d/backtesting/_plotting.py#L400-L426

kernc avatar Aug 10 '22 14:08 kernc