Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Point and Click indicator?
Collapse
X
-
Hello cassb,
Please use the Print function to get the value of all the methods. If you are getting an unexpected value then you have to recalculate for the right x value.
A sample code will be like
Code:idx = Math.Min(CurrentBar , Bars.Count - 2) - ChartControl.LastBarPainted + idx;
Leave a comment:
-
OK Joydeep, I have been testing the code that finds the bar index from the X position:
Code:int barclick = (int)(xpos/ChartControl.BarSpace); //gets the bar, from the painted ones where the mouse is clicked int idx = ChartControl.BarsPainted - barclick ; idx = Bars.Count - 2 - ChartControl.LastBarPainted + idx;
Thanks!
Bryan
Leave a comment:
-
Hello cassb,
Yes, you have to know the min and max values.
To avoid double paint you can also use the unsupported overload GetMinMaxValues instead of the Plot.
Please let me know if I can assist you any further.
Leave a comment:
-
Originally posted by NinjaTrader_Joydeep View PostHello cassb,
It is possible to get the price from the Y value. Please refer here to these posts for some ideas
Hey, Just saw it... Honestly I don't remember anything from this issue... Good you figured it... Lol Yeah it took a bit of searching around but finally got it. One great thing with forums is that you do get solutions and help if you need but there are many partial or incorrect postings that lead you the wrong way. And when something is incorrect / partial, generally there is no follow up to it. So you dont know why a particular approach does not work. :-) Anyways, I am happy I get what I am looking …
Please let me know if I can assist you any further.
Code:public override void Plot(Graphics graphics, Rectangle bounds, double min, double max) { priceMin = min; priceMax = max; boundsTop = bounds.Top; boundsHeight = bounds.Height; }
Leave a comment:
-
Hello cassb,
It is possible to get the price from the Y value. Please refer here to these posts for some ideas
Hey, Just saw it... Honestly I don't remember anything from this issue... Good you figured it... Lol Yeah it took a bit of searching around but finally got it. One great thing with forums is that you do get solutions and help if you need but there are many partial or incorrect postings that lead you the wrong way. And when something is incorrect / partial, generally there is no follow up to it. So you dont know why a particular approach does not work. :-) Anyways, I am happy I get what I am looking …
Please let me know if I can assist you any further.
Leave a comment:
-
Actually, if you could help with one more thing. I see that you derive the bar number from the X position like this:
int barclick = (int)(xpos/ChartControl.BarSpace); //gets the bar, from the painted ones where the mouse is clicked
How would I also derive the price value using the Y position?
Thanks!
Leave a comment:
-
Hello cassb,
Thanks for writing in and I am happy to assist you.
Yes it is possible to calculate the bar number from the mouse click using unsupported NinjaScript functions.
Please refer to this thread for more http://ninjatrader.com/support/forum...ight=dsdatabox
Please let me know if I can assist you any further.
Leave a comment:
-
Point and Click indicator?
Is it possible to write an indicator that monitors the chart so that when you click the mouse on Panel 1, the indicator can capture the bar number and price where the user clicked? I'm not interested in the X,Y grid value though, unless I can derive the bar number and price from that.
Thanks!
BryanTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, Today, 12:45 PM
|
2 responses
16 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
15 responses
3,272 views
0 likes
|
Last Post Today, 03:15 PM | ||
Started by Tim-c, Today, 02:10 PM
|
1 response
8 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
51 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
Leave a comment: