Convert mouse x/y location to Time & Price - futures io
futures io



Convert mouse x/y location to Time & Price


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one YuvalW with 4 posts (4 thanks)
    2. looks_two saikodi with 3 posts (0 thanks)
    3. looks_3 Mindset with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,242 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 8 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Convert mouse x/y location to Time & Price

(login for full post details)
  #1 (permalink)
 YuvalW 
USA
 
Experience: Beginner
Platform: NinjaTrader
 
Posts: 26 since Jul 2009
Thanks: 4 given, 17 received

Hi all,

any idea of how can I convert mouse x/y location (on the chart panel) to Time/Price?

ChartControl has "GetTimeByX" method, this is internal method but I can try call it via reflection, but I don't see something for y/price conversion...

Thx for any help,

Yuval.

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
TOS plotting horizontal line for open in renko chart
ThinkOrSwim
Simple code to end my indicator
NinjaTrader
text block indicator that moves with price
NinjaTrader
Alternative to Mcginley Dynamic MA
Sierra Chart
Tradestation 10 work offline
TradeStation
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Vinny E-Mini & Algobox Review TRADE ROOM
144 thanks
Would you share your Holy Grail?
72 thanks
EURUSD M6E/6E Euro
47 thanks
Spoo-nalysis ES e-mini futures S&P 500
37 thanks
ApexTraderFunding.com experience and review
14 thanks
 
(login for full post details)
  #3 (permalink)
 YuvalW 
USA
 
Experience: Beginner
Platform: NinjaTrader
 
Posts: 26 since Jul 2009
Thanks: 4 given, 17 received


OK, got it:

 
Code
 
// Global vars.
private double priceMin;
private double priceMax;
private int boundsTop;
private int boundsHeight;
 
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max) 
{
    priceMin = min;
    priceMax = max;
    boundsTop = bounds.Top;
    boundsHeight = bounds.Height;
 
    base.Plot(graphics, bounds, min, max);
}
 
private void chart_MouseClick(object sender, MouseEventArgs e)
{
    Panel chartPanel = sender as Panel;
    if (chartPanel == null)
        return;
 
    if (e.Clicks == 1)
    {
        double price = priceMax - (e.Y-boundsTop)*(priceMax-priceMin)/boundsHeight;
        Print(Instrument.MasterInstrument.Round2TickSize(price));
    }
}

Started this thread Reply With Quote
The following 4 users say Thank You to YuvalW for this post:
 
(login for full post details)
  #4 (permalink)
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
 
Mindset's Avatar
 
Posts: 362 since Sep 2009
Thanks: 89 given, 290 received

Have you tested this with multiple charts on same panel?
I think you will run into some issues with this code.

Reply With Quote
 
(login for full post details)
  #5 (permalink)
 YuvalW 
USA
 
Experience: Beginner
Platform: NinjaTrader
 
Posts: 26 since Jul 2009
Thanks: 4 given, 17 received

No I have not.
Interesting... how the fib tools work on multiple charts? what values does it take? I'll check when I'll get back home..

Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
 saikodi 
Seattle WA/USA
 
Experience: Advanced
Platform: ThinkorSwim, NinjaTrader
Trading: ES, YM, CL
 
Posts: 27 since Oct 2012
Thanks: 3 given, 13 received


YuvalW View Post
No I have not.
Interesting... how the fib tools work on multiple charts? what values does it take? I'll check when I'll get back home..

I know this is a very old post but I am looking for the same thing. On mouse click on a chart, I want to know the price where the click happened. I tried with the code posted here but that doesnt seem to work. Any ideas??

Reply With Quote
 
(login for full post details)
  #7 (permalink)
 saikodi 
Seattle WA/USA
 
Experience: Advanced
Platform: ThinkorSwim, NinjaTrader
Trading: ES, YM, CL
 
Posts: 27 since Oct 2012
Thanks: 3 given, 13 received


saikodi View Post
I know this is a very old post but I am looking for the same thing. On mouse click on a chart, I want to know the price where the click happened. I tried with the code posted here but that doesnt seem to work. Any ideas??

Never mind. Figured it out.

Reply With Quote
 
(login for full post details)
  #8 (permalink)
 YuvalW 
USA
 
Experience: Beginner
Platform: NinjaTrader
 
Posts: 26 since Jul 2009
Thanks: 4 given, 17 received


saikodi View Post
Never mind. Figured it out.

Hey,
Just saw it... Honestly I don't remember anything from this issue... Good you figured it... Lol

Started this thread Reply With Quote
 
(login for full post details)
  #9 (permalink)
 saikodi 
Seattle WA/USA
 
Experience: Advanced
Platform: ThinkorSwim, NinjaTrader
Trading: ES, YM, CL
 
Posts: 27 since Oct 2012
Thanks: 3 given, 13 received


YuvalW View Post
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 for from this forum consistently.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Convert mouse x/y location to Time & Price


Last Updated on October 26, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts