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 | ||
---|---|---|---|---|
Started by smartromain, 03-13-2024, 01:42 AM
|
5 responses
92 views
0 likes
|
Last Post
by AndreiBig
Today, 06:08 AM
|
||
Started by Noerclou, Today, 04:55 AM
|
0 responses
4 views
0 likes
|
Last Post
by Noerclou
Today, 04:55 AM
|
||
Started by llanqui, Yesterday, 09:59 AM
|
2 responses
17 views
0 likes
|
Last Post
by llanqui
Today, 04:00 AM
|
||
Started by ThoriSten, Today, 03:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by ThoriSten
Today, 03:56 AM
|
||
Started by PhillT, 04-19-2024, 02:16 PM
|
3 responses
25 views
0 likes
|
Last Post
by mangel2000
Today, 03:04 AM
|
Comment