Skip to content

Change lines - quick question #447

Answered by seyeint
seyeint asked this question in Q&A
Sep 2, 2023 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

Final answer, its closed now.
The function add_line ALWAYS transforms the raw date into ordinal/index time relative to the number of candles in the current chart.
Meaning one can CREATE lines with normal timestamp dates, but if one wants to update and not just eliminate and re-draw, one has to now use the following method to get their x coordinates for the line.points() update.

py = price where that line was innitially marked.
p1x, p2x = fplt._pdtime2index(ax, pd.Series([p1x, p2x])), where p1x can be for example the old p1x and p2x might be the new extended p2x.
old_line.points = ((p1x, py), (p2x, py))

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@seyeint
Comment options

@highfestiva
Comment options

@seyeint
Comment options

@seyeint
Comment options

Answer selected by seyeint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants