finplot icon indicating copy to clipboard operation
finplot copied to clipboard

[BUG] marker position get displaced when plot second time

Open skunkyevil opened this issue 2 years ago • 2 comments

Requirements (place an x in each of the [ ])**

  • [x ] I realize finplot is not a web lib. (Hint: it's native!)
  • [ x] I've read the snippets and not found what I'm looking for.
  • [ x] I've searched for any related issues and avoided creating a duplicate issue.
  • [x ] I've updated finplot (pip install -U finplot).
  • [x ] I've supplied the required data to run my code below.

Code to reproduce

The code along with csv files is inside attached .zip archive: bug.zip

Describe the bug

I plot bars (1 minute, NQM23 contract), then I draw markers. Please don't pay attention that markers are not tied to the prices and kind of "hang in the air". The unexpected behavior is that when I plot marker_up second time, this set of marker is displaced by 4 bars (if you zoom into rightmost markers, see the image)

Expected behavior

When I plot marker_up second time it should appear in the same location as for the first time.

Screenshots

4_bars_distance

Reproducible in:

OS: Windows 10 finplot version: finplot-1.9.2 pyqtgraph version: 0.13.3 pyqt version: 6.5.2

skunkyevil avatar Oct 06 '23 20:10 skunkyevil

This is a bug in finplot, caused by you plotting a bunch of indexes in that are not present in the first candlestick plot. A couple of examples:

2023-06-16 11:26:00 - present in marker_up, but not in ochl
2023-03-01 18:20:00 - present in marker_down, but not in ochl
2023-03-09 00:00:00 - present in marker_down, but not in ochl

etc. Anyway, this is the reason. To circumvent the bug, you can ensure all indexes are the same before plotting.

I seem to remember something related to how I implemented this which has to do with runtime updates. Perhaps this might be a bit difficult to fix. Please keep the issue open in the meanwhile, thanks!

highfestiva avatar Oct 07 '23 19:10 highfestiva

Thanks for being so prompt and helpful on this. I will always filter the indexes on my side for now

skunkyevil avatar Oct 11 '23 22:10 skunkyevil