ChartControl.ChartObjects.InsertComplete
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
InsertComplete
Collapse
X
-
Originally posted by NinjaTrader_PatrickH View PostHello Edge,
Thank you for your post.
There would not be an equivelent to ChartControl.ChartObjects.InsertComplete. What are you trying to accomplish? Why were you using InsertComplete in NinjaTrader 7?
I look forward to your response.
Code:[COLOR=#006400]private void myMethod(object sender, CollectionEventArgs e) { }[/COLOR]
Code:[COLOR=#006400]private void myMethod(object sender, O[COLOR=#080808]bservableCollectionEventArgs[/COLOR][COLOR=#000000]<T[/COLOR][COLOR=#000000]>[/COLOR] e) { }[/COLOR]
Edit - Modified to button click event...Last edited by -=Edge=-; 06-17-2015, 10:51 AM.
Comment
-
There are no public events that would match here, we'd like to know how you're using that in NT7 (what exactly are you trying to hook on to? Notify when an instrument changes? An indicator has been added? Drawing tool changed?) so we can provide an existing equivalent in NT8 which would accomplish your goal, or check back with development if there should be something internal that needed to be exposed for your task.MatthewNinjaTrader Product Management
Comment
-
Originally posted by NinjaTrader_Matthew View PostThere are no public events that would match here, we'd like to know how you're using that in NT7 (what exactly are you trying to hook on to? Notify when an instrument changes? An indicator has been added? Drawing tool changed?) so we can provide an existing equivalent in NT8 which would accomplish your goal, or check back with development if there should be something internal that needed to be exposed for your task.
Last edited by -=Edge=-; 06-17-2015, 11:59 AM.
Comment
-
Originally posted by NinjaTrader_Matthew View PostThere are no public events that would match here, we'd like to know how you're using that in NT7 (what exactly are you trying to hook on to? Notify when an instrument changes? An indicator has been added? Drawing tool changed?) so we can provide an existing equivalent in NT8 which would accomplish your goal, or check back with development if there should be something internal that needed to be exposed for your task.
Not so much when it's done thru the indicator property menu, but when you click on the indicator to select it and either use the context menu to remove and/or hit the delete key to delete it from the chart?
Comment
-
Originally posted by -=Edge=- View PostThis is totally unrelated to what I'm trying to do above, but since you brought it up.. Is there any way of hooking to an event when an indicator has been manually deleted from the chart..
Not so much when it's done thru the indicator property menu, but when you click on the indicator to select it and either use the context menu to remove and/or hit the delete key to delete it from the chart?
Otherwise, I think that OnTermination() would be run before the indicator is removed, so one can unsubscribe there explicitly (which you would have already coded anyway ).Last edited by koganam; 06-17-2015, 01:26 PM.
Comment
-
Originally posted by koganam View PostI should think that the Garbage Collector would handle that, as there would no longer be a reference to the subscribed instance of the eventHandler in any running code.
Otherwise, I think that OnTermination() would be run before the indicator is removed, so one can unsubscribe there explicitly (which you would have already coded anyway ).
Currently if you add any type of new button, panel, toolbar, grid, etc to the chart itself (as a child of the ChartControl) thru an indicator, whenever the main grid is updated (for instance after a manual indicator deletion, a change in dataseries property, and possibly even other things that I've yet to run across) it looses track of those objects that were added, and currently the indicator needs to be reloaded to get them back..
I guess what might work is a way of hooking into the grid update event handler, and then forcing the indicator to reload automatically.. But this is already a known issue, and I'm sure they'll come up with something for us..
Comment
-
Originally posted by NinjaTrader_Matthew View PostThe ChartScales has as ChartObjects object which is an observable collection and therefore has a CollectionChanged NotifyCollectionChangedEvent. The attached should demonstrate how to use this undocumented feature.
Comment
-
Hi...
Once we have the object changed...
Print(e.NewItems[0].ToString() + " was added");
How can we get its details ?
I got this ;
IDrawingTool x = (IDrawingTool) e.NewItems[0];
Print("Name = " + x.Name ) ;
Print("Tag = " + x.Tag ) ;
Print("Panel = " + x.PanelIndex ) ;
but would need to get the Color and the Bars Ago
Comment
-
Hello pmaglio, and thank you for your question.
You may use the nested ChartAnchors to retrieve BarsAgo information. These are documented here, I recommend using the 0th member.
For brushes, I would like to recommend using a C# dictionary to map the IDrawingObject's Tag member, which uniquely identifies the drawing object, to the Brush you used to draw it, at the time you create the object. For example,
Code:[FONT=Courier New] private system.collections.generic.Dictionary<string, Brush> myMap;[/FONT]
Code:[FONT=Courier New]else if (State == State.Configure) { myMap = new system.collections.generic.Dictionary<string, Brush>(); }[/FONT]
Code:[FONT=Courier New] Diamond myDiamond = Draw.Diamond(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red); myMap[myDiamond.Tag] = Brushes.Red;[/FONT]
Jessica P.NinjaTrader Customer Service
Comment
-
Just one more question....
If my code is not the one painting the object,
so Im just detecting them as it used to be on Ninja 7 with ChartControl.ChartObjects.InsertComplete or now on Ninja 8 with private void myCollectionChanged() as explained by Matthew
Now I have the new detected object on x;
IDrawingTool x = e.NewItems[0] as IDrawingTool;
Is it correct to do this ?
foreach (ChartAnchor anchor in x.Anchors)
{
Print("Bars Ago = "+ anchor.BarsAgo);
}
... because I am not getting a valid result
( I was expecting to get 0 for objects painted on current bar ... 1 for previous bars and so on... but I only get a big fixed integer number )
Comment
-
Thanks once again for your question, and for using NinjaTrader 8
I am investigating this on our end and reviewing the expected operation of NinjaTrader. I appreciate your patience with this process. Should this not be the expected operation of Ninja I will return with a bug tracking number.
Should this be a NinjaTrader bug, a stripped down code sample from you highlighting what is occurring would be greatly appreciated.Jessica P.NinjaTrader Customer Service
Comment
-
Hello pmaglio,
I do not believe we will be able to use either the NewItems or the OldItems List. When I use the attached code, both NewItems and OldItems are always null. I believe on your system you may be retrieving uninitialized objects.
In case I may have misunderstood or coded something improperly, would it be possible for you to modify the sample I have attached so that it reproduces the conditions you are observing?Attached FilesJessica P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by The_Sec, Yesterday, 03:53 PM
|
1 response
12 views
0 likes
|
Last Post Today, 06:23 AM | ||
Started by mmenigma, Yesterday, 03:25 PM
|
1 response
11 views
0 likes
|
Last Post Today, 06:09 AM | ||
Started by kujista, Today, 05:44 AM
|
0 responses
7 views
0 likes
|
Last Post
by kujista
Today, 05:44 AM
|
||
Started by ZenCortexCLICK, Today, 04:58 AM
|
0 responses
9 views
0 likes
|
Last Post Today, 04:58 AM | ||
Started by sidlercom80, 10-28-2023, 08:49 AM
|
172 responses
2,282 views
0 likes
|
Last Post
by sidlercom80
Today, 04:40 AM
|
Comment