Skip to content

Conversation

@itzzp
Copy link

@itzzp itzzp commented May 28, 2022

Other points snap to the same height while keeping their x-value

@highfestiva
Copy link
Owner

Interesting idea! Are you sure that it's not better to shift-draw in order to make a straight line from the previous handle? Feels a bit odd to move all previous segments. Could you explain the rationale if you have say 3 handles (and two segments) placed and you move the last one with shift — why do you want the first handle to move? Or would it be better to just move the one next to the handle you're dragging?

@itzzp
Copy link
Author

itzzp commented May 31, 2022

You could argue that Shift draw would be better so the user does not have to draw line using ctrl-drag and make it perfect horizontal afterwards. But on the other hand it is also not a problem to draw a line through local price peaks for example and check using shift drag to check if the trend line would also fit when forcing it to be horizontal else drag it a bit after wards.

I use tc2000 a lot (https://www.tc2000.com/). There it is implemented like I proposed: dragging with the mouse adds a (slanted) trend line and than dragging one of the handles while holding Shift makes the opposite handle adjust it's y-axis value to keep the line horizontal. I like tc2000, the only problem with it is that you can not export the annotation the user makes. I want to annotate the chart with horizontal and slanted trend lines and to be able to use this data for backtesting and later to use the drawn lines as trigger lines to automatically enter/exit a trade. With your api I can add a some code to store the line positions in a database.

About your remarks on how to handle PolyLines. I think on price charts most people use straight lines of one segment as trend lines. (fyi: I personally turned of the part of the code that splits one segment into two so I do not unintentionally do that).
But you are correct: In that case of a multisegment polyline this feature is less useful because you always end up with a single horizontal line. But hey, than just do not press Shift while dragging :)

@highfestiva
Copy link
Owner

I like to keep compatibility, so I don't take lightly to assigning a key to a functionality. In almost all drawing programs, Ctrl+drag means draw horizontally or vertically. Hm. Perhaps I need to rethink my current binding. I'm sure it's not going to be exactly what you did, but I need to think about this. Please don't close this issue.

@itzzp
Copy link
Author

itzzp commented Jun 3, 2022

Thank you for taking the time to consider adding this in one way or the other. I won't close this issue.

@itzzp
Copy link
Author

itzzp commented Oct 27, 2025

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants