How to capture a mouse click's location on chart in NT7. - NinjaTrader Programming | futures io social day trading
futures io futures trading


How to capture a mouse click's location on chart in NT7.
Updated: Views / Replies:290 / 4
Created: by forrestang Attachments:1

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

How to capture a mouse click's location on chart in NT7.

  #1 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,039 since Jun 2010
Thanks: 226 given, 688 received

How to capture a mouse click's location on chart in NT7.

Hello.

THis is likely something that not too many people have experience doing in NT.

But what I am looking to do, is have an indicator, that once ENABLED(via button somewhere in the chart), that will capture the x/y position upon a mouse-click.

I'd then translate that into price and time.

I am thinking the ENABLE button would have to disable the native chart controls so that the clicking can occur. As I will be doing some reporting both onto the chart and to the output window.

But the most important things that I don't know how to do in NT7 are:
  • Create a button that will enable/disable the script while it is loaded onto a chart
  • Capture the X/Y position on mouse-click once that button is enabled

Just checking to see if anyone has done anything similar to this?

Thanks

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,504 since Sep 2013
Thanks: 1,706 given, 3,717 received
Forum Reputation: Legendary


You may want to use something like this :

In the function that gets triggered when clicking the toolbar, you then can toggle a flag to stop your script.

 
Code
private ToolStripButton _myButton;

private void add_Button()
{
	try
	{
		ToolStrip toolStrip = ((Control)this.ChartControl).Controls["tsrTool"] as ToolStrip;
		if (toolStrip != null && toolStrip.Items.ContainsKey("btnMY") )
		{
			toolStrip.Items.RemoveByKey("btnMY");
		}

				
		if (toolStrip != null && !toolStrip.Items.ContainsKey("btnMY"))
		{					
			this._myButton = new ToolStripButton("butMY", (Image)null, new EventHandler(this.myButton_Clicked), "btnMY");
			this._myButton.CheckOnClick = true;
			toolStrip.Items.Add((ToolStripItem)this._myButton);
		}
		else
		{
			if (toolStrip.Items.ContainsKey("btnMY") )
			{
				//Print("Button btnMY exists");
			}
	        }
					
		if (this._myButton == null)
			return;
				
		this._myButton.Checked = ;
	}
	catch
	{
	}
}



private void remove_Button()
{
	ToolStrip toolStrip = ((Control)this.ChartControl).Controls["tsrTool"] as ToolStrip;
	if (toolStrip == null || !toolStrip.Items.ContainsKey("btnMY"))
		return;
	toolStrip.Items.RemoveByKey("btnMY");
			
}

private void myButton_Clicked (object sender, EventArgs e)
{
	// put your code here
}

protected override void OnStartUp()
{
	if (this.ChartControl == null )
	{
		return;
	}
	this.add_Button();
}

protected override void OnTermination()
{
	
	this.remove_Button();			
}

Reply With Quote
The following user says Thank You to rleplae for this post:
 
  #4 (permalink)
Elite Member
Prague, Czech Republic
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: NQ
 
Posts: 52 since Sep 2009
Thanks: 31 given, 73 received


forrestang View Post
Hello.

THis is likely something that not too many people have experience doing in NT.

But what I am looking to do, is have an indicator, that once ENABLED(via button somewhere in the chart), that will capture the x/y position upon a mouse-click.

I'd then translate that into price and time.

I am thinking the ENABLE button would have to disable the native chart controls so that the clicking can occur. As I will be doing some reporting both onto the chart and to the output window.

But the most important things that I don't know how to do in NT7 are:
  • Create a button that will enable/disable the script while it is loaded onto a chart
  • Capture the X/Y position on mouse-click once that button is enabled

Just checking to see if anyone has done anything similar to this?

Thanks

@forrestang
I wrote some code for you - add button to tool strip, if button is enabled and you clicked on chart, indicator prints info about clicked coordinates to output window. If you like print or draw some info into chart, input your code into Plot() function.

Attached Files
Register to download File Type: zip ButtonMouseCoordinates.zip (3.1 KB, 9 views)
Reply With Quote
The following 4 users say Thank You to asfax for this post:
 
  #5 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,039 since Jun 2010
Thanks: 226 given, 688 received


asfax View Post
@forrestang
I wrote some code for you - add button to tool strip, if button is enabled and you clicked on chart, indicator prints info about clicked coordinates to output window. If you like print or draw some info into chart, input your code into Plot() function.

Wow sir!!!

That is EXACTLY what I needed. I should be able to do whatever I need to with that script.

These type of things I imagine not many of us have experience doing, so this helps out a ton.

Reply With Quote
The following 2 users say Thank You to forrestang for this post:

Reply



futures io > > > > > How to capture a mouse click's location on chart in NT7.

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
one mouse click = multiple programs' actions SARdynamite Tech Support 8 November 4th, 2015 10:37 AM
Convert mouse x/y location to Time & Price YuvalW NinjaTrader Programming 8 October 26th, 2014 12:11 PM
mouse click for Buy Stop and Sell stop On NT7 lexxmd NinjaTrader 8 May 15th, 2014 09:46 AM
Buy Market Mouse Click canthony The Elite Circle 1 May 13th, 2014 12:54 PM
Please vote for - Mouse Click event in MC ejtrader MultiCharts 1 June 2nd, 2011 08:58 PM


All times are GMT -4. The time now is 09:45 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-17 in 0.10 seconds with 20 queries on phoenix via your IP 107.20.115.174