RemoveDrawObject does not remove User objects from the Chart - NinjaTrader | futures io social day trading
futures io futures trading


RemoveDrawObject does not remove User objects from the Chart
Updated: Views / Replies:1,386 / 4
Created: by AlBundy Attachments:0

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
 

RemoveDrawObject does not remove User objects from the Chart

  #1 (permalink)
Elite Member
Vienna Austria
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Forex
 
AlBundy's Avatar
 
Posts: 25 since Jun 2013
Thanks: 10 given, 11 received

RemoveDrawObject does not remove User objects from the Chart

Hi,

can it be the function RemoveDrawObject() does not delete objects which the user has added manually to the chart? I checked it many times and that far I do not see any problem/bug in the code. I can remove objects which the indicator created but when I try to remove an object which has been added by the user to the chart it does not work. Neither when I reference it by the tag, nor by the object id directly [RemoveDrawObject() has 2 overloads].

The behaving does not change if I lock/unlock the object or to what ever I assign it.

It looks for me NinjaTrader framework does not allow the C# code delete objects which have been created by the user.

Any ideas?

Reply With Quote
 
  #2 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


AlBundy View Post
Hi,

can it be the function RemoveDrawObject() does not delete objects which the user has added manually to the chart? I checked it many times and that far I do not see any problem/bug in the code. I can remove objects which the indicator created but when I try to remove an object which has been added by the user to the chart it does not work. Neither when I reference it by the tag, nor by the object id directly [RemoveDrawObject() has 2 overloads].

The behaving does not change if I lock/unlock the object or to what ever I assign it.

It looks for me NinjaTrader framework does not allow the C# code delete objects which have been created by the user.

Any ideas?


You can apply different indicators to your chart. When you use RemoveDrawObjects() within one indicator, it will not

- remove draw objects created via any other indicator or strategy
- remove draw objects that you have manually added

This is as expected.

You can remove manually added draw objects manually.

Reply With Quote
 
  #3 (permalink)
Elite Member
Vienna Austria
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Forex
 
AlBundy's Avatar
 
Posts: 25 since Jun 2013
Thanks: 10 given, 11 received



Fat Tails View Post
You can apply different indicators to your chart. When you use RemoveDrawObjects() within one indicator, it will not

- remove draw objects created via any other indicator or strategy
- remove draw objects that you have manually added

This is as expected.

You can remove manually added draw objects manually.

Good. This is the official function. Due the fact NT can delete all objects and it is not running as an OS in a privileged mode there is a function which can delete manually added draw objects.

Has somebody a control in mind I can start to check? It must be a non public method...

Reply With Quote
 
  #4 (permalink)
Elite Member
Vienna Austria
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Forex
 
AlBundy's Avatar
 
Posts: 25 since Jun 2013
Thanks: 10 given, 11 received

SOLVED!


aiforus View Post
1) Use Reflection to get extra information on undocumented methods and fields at runtime (write your own code in indicator)
2) Try to get extra information from NT .NET assemblies using software such as Reflector

Yes, Reflector was the key to success. I found a solution how to remove manually drawn objects from the chart:

 
Code
BindingFlags bfObject = BindingFlags.Instance | BindingFlags.NonPublic;
MethodInfo methodNT = typeof(ChartControl).GetMethod("RemoveDrawingObjectsAfterBar", bfObject);
methodNT.Invoke(this.ChartControl, new Object [] { 0 });

This method may not be for all suitable because it is deleting all drawn objects [also the objects drawn from any indicator] from the chart. I did not want to spend more time to investigate because it works for me.

Due the fact I have all drawn objects created by the indicator in an internal structure I just repaint them after calling the Invoke method and then I invalidate and refresh the chart. It goes that fast that it looks very smooth and indeed only the manually drawn objects are deleted.

If somebody finds a better solution please post it.

Reply With Quote
The following 2 users say Thank You to AlBundy for this post:
 
  #5 (permalink)
Elite Member
Bremen Germany
 
Futures Experience: Advanced
Platform: NinjaTrader, MT4 and others
Favorite Futures: EURUSD
 
Posts: 2 since Jan 2012
Thanks: 0 given, 1 received

Hi AlBundy,

I'm looking for a solution for the same problem. I would like to delete manually drawn traingle by indicator. Would you give me your code?

Reply With Quote

Reply



futures io > > > > RemoveDrawObject does not remove User objects from the Chart

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove plot from chart haonkered EasyLanguage Programming 7 December 15th, 2014 04:45 PM
Inaccurate transfer of drawing objects from chart to chart in Ninja be fixed in NT8? moneypenny NinjaTrader 1 June 7th, 2014 11:31 AM
Multiple "User" Broker Account on Multi User Platform bullsandthebears Reviews of Brokers and Data Feeds 4 August 3rd, 2012 09:58 PM
How To Manually Remove A Text ALERT From A Chart jmca2000 NinjaTrader Programming 3 July 21st, 2010 01:46 AM
Who asked the question about hotkey for remove draw objects? Todd Traders Hideout 3 June 8th, 2010 10:43 PM


All times are GMT -4. The time now is 03:28 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-13 in 0.09 seconds with 19 queries on phoenix via your IP 54.226.132.197