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
What do I need to learn programming NinjaScript?
Collapse
X
-
It would need to be further isolated then, would you see the same if you close out any unneeded applications running in the background, as well as other workspaces / chart potentially run on COBC = false?
Generally C# is a managed, yet powerful and performing language and we would run all your scripts in compiled state for highest runtime performance possible.BertrandNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Bertrand View PostIt would need to be further isolated then, would you see the same if you close out any unneeded applications running in the background, as well as other workspaces / chart potentially run on COBC = false?
Generally C# is a managed, yet powerful and performing language and we would run all your scripts in compiled state for highest runtime performance possible.
It has been quite a long time since my last post. I have just figured out a way to track my mouse move real-time. However, I dont understand why the code just work fine when I start a new chart and attach the indicator to the chart. When it is working nicely, if I remove the indicator then re-add it, or if I change the instrument, the indicator stops working.
Could you please let me know some reason? Thank you!
Here is my code, which displays the X and Y coordinates of mouse location in real time:
Code:#region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // User defined variables (add any user defined variables below) private int X = 0, Y = 0; #endregion protected override void Initialize() { Overlay = true; CalculateOnBarClose = true; } protected override void OnStartUp() { ChartControl.ChartPanel.Paint += new PaintEventHandler(MyPaint); ChartControl.ChartPanel.MouseMove += new MouseEventHandler(OnMouseMove); } void OnMouseMove(object sender, MouseEventArgs e) { X = e.X; Y = e.Y; ChartControl.ChartPanel.Refresh(); } void MyPaint(object sender, PaintEventArgs e) { DrawTextFixed("info", "X = " + X + "\nY = " + Y, TextPosition.BottomRight, Color.Red, new Font("Arial", 20f), Color.Black, Color.Yellow, 100 ); } protected override void OnBarUpdate() { }
Last edited by tracoder; 12-02-2013, 10:17 PM.
Comment
-
Tracoder,
Thank you for your reply.
I tested out the code on my end and ran some print statements from the script. I noticed that when I removed the indicator from the chart the print statements were still being called. You would need to use the OnTerminationI() method to clean up the script.
http://www.ninjatrader.com/support/h...ermination.htmCal H.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Cal View PostTracoder,
Thank you for your reply.
I tested out the code on my end and ran some print statements from the script. I noticed that when I removed the indicator from the chart the print statements were still being called. You would need to use the OnTerminationI() method to clean up the script.
http://www.ninjatrader.com/support/h...ermination.htm
Thank you for your test. I have just figured how to do this smoothly and stably.
OnTermination is also a part of the changes. The most important thing is to use TriggerCustomEvent to call my actual handlers. Bypassing TriggerCustomEvent causes unpredictable outcomes.
Thank you!
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Can someone turn this thinkscript into a ninjascript. 5PM CST OHL and Previous Day
by Option Whisperer
Started by Option Whisperer, Today, 09:55 AM
|
1 response
11 views
0 likes
|
Last Post
by bltdavid
Today, 02:44 PM
|
||
Started by port119, Today, 02:43 PM
|
0 responses
1 view
0 likes
|
Last Post
by port119
Today, 02:43 PM
|
||
Started by Philippe56140, Today, 02:35 PM
|
0 responses
3 views
0 likes
|
Last Post Today, 02:35 PM | ||
Started by 00nevest, Today, 02:27 PM
|
0 responses
2 views
0 likes
|
Last Post
by 00nevest
Today, 02:27 PM
|
||
Started by Jonafare, 12-06-2012, 03:48 PM
|
5 responses
3,986 views
0 likes
|
Last Post
by rene69851
Today, 01:44 PM
|
Comment