Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Collecting two mouse click point from indicator
Collapse
X
-
Hello,
Thank you for your post.
I'm attaching two examples below, one will print the price and time of the clicked position, and one will draw a drawing object where the mouse is clicked. You'd want to grab the x/y coordinates of the first click, convert those to a time and price, wait for the second click, get the time and price of those, and then use those times and prices as the anchors for the line.
Please let us know if we may be of further assistance to you.Attached Files
- Likes 1
-
Thanks Kate. As per your suggestion, drawing tool has to remember the first click details? In my use case , after i clicked my drawing tool icon , i want to capture next two mouse clicks. I don't want capture all the mouse clicks. Until I do my second click, mouse cursor symbol should not change back to normal from pen .
Comment
-
Hello nandhumca,
Thank you for your reply.
In this case, you would not be clicking on the drawing tool and drawing using that tool - you would simply click once on the chart, get the x-y coordinates and translate those to a price/time, save those to variables, maybe something like Click1Price = whatever price it was at and then Click1Time for the time on the x-axis the click was at, then click a second time at your desired end point, again get the x-y coordinates and translate those to a price/time and save the second click's price and time to another set of variables. Then you can simply call Draw.Line() to draw the line from the script using those prices and times you saved from the mouse clicks as the start and end point price and times.
Please let us know if we may be of further assistance to you.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment