Get all draw objects - NinjaTrader Programming | futures io social day trading
futures io futures trading


Get all draw objects
Updated: Views / Replies:4,856 / 18
Created: by dimkdimk 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
 1  
 
Thread Tools Search this Thread
 

Get all draw objects

  #11 (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


ratfink View Post
I assume there is a nested access route through the object list, but I haven't used it so may be wrong.

Unfortunately this is not possible/supported for this object. The member is apparently not public. I try to get all members with the BindingFlags functionality.

Reply With Quote
The following user says Thank You to AlBundy for this post:
 
  #12 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received

@gregid spotted it (ChartObject not IChartObject), so use this

 
Code
	bool done = false;

         protected override void Initialize()
        {
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
            Overlay				= false;
        }
		

	protected override void OnBarUpdate()
        {
			if (!done)
			{
				foreach (ChartObject co in ChartControl.ChartObjects)
				{
					Print("Y is " + co.Y.ToString("0.00000"));
				}
				
				done = true;
			}
        }

Travel Well
Reply With Quote
 
  #13 (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

I think it is not in the ChartControl object


I attached a file with all members of ChartObject.

There is Y and startY but nothing which looks like endY. I guess NT is saving this additional information somewhere else...

Somebody an idea?

Attached Files
Register to download File Type: txt MembersOfChartObject.txt (6.1 KB, 13 views)

Last edited by AlBundy; February 14th, 2015 at 11:34 AM.
Reply With Quote
 
  #14 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received

Looks like you have to use the DrawObjects list and then convert (e.g. to ILine, etc) from there.

 
Code
		foreach (IDrawObject draw in DrawObjects)
		{
			Print("draw obj " + draw.ToString());
		}
e.g. will give:

draw obj Name='Horizontal Line' StartY='10981.40'
draw obj Name='Line' Time='13/02/2015 20:01:00', StartBar='3300' StartY='10967.79' EndTime='13/02/2015 20:26:00' EndBar='3325' EndY='10973.97'

(There is code in the Ninja manual for checking tags, etc.)

Travel Well
Reply With Quote
 
  #15 (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


ratfink View Post
Looks like you have to use the DrawObjects list and then convert (e.g. to ILine, etc) from there.

 
Code
		foreach (IDrawObject draw in DrawObjects)
		{
			Print("draw obj " + draw.ToString());
		}
e.g. will give:

draw obj Name='Horizontal Line' StartY='10981.40'
draw obj Name='Line' Time='13/02/2015 20:01:00', StartBar='3300' StartY='10967.79' EndTime='13/02/2015 20:26:00' EndBar='3325' EndY='10973.97'

(There is code in the Ninja manual for checking tags, etc.)


The issue is the .ToString() method returns only 2 digits after comma for StartY and EndY. You tested it probably with DAX Future. Try it with EURUSD and you will see the problem. When you draw a line from 1.1356 to 1.1390 then it returns always 1.14 and this is useless.

I wrote a small program which returns all field and property values from ChartObject and there is definitely no EndX - see the attachment from my previous post. I don't understand from where .ToString() gets EndX?!

Reply With Quote
 
  #16 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received


AlBundy View Post
The issue is the .ToString() method returns only 2 digits after comma for StartY and EndY. You tested it probably with DAX Future. Try it with EURUSD and you will see the problem. When you draw a line from 1.1356 to 1.1390 then it returns always 1.14 and this is useless.

I wrote a small program which returns all field and property values from ChartObject and there is definitely no EndX - see the attachment from my previous post. I don't understand from where .ToString() gets EndX?!

Yes, that's why I gave you the earlier example showing the 'ToString("0.00000") to get 5 places.

And look in the Ninja manual to see them using ILine objects from the DrawObjects list.

Travel Well
Reply With Quote
The following user says Thank You to ratfink for this post:
 
  #17 (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


gregid View Post
There is a Y object, try this:
 
Code
foreach (ChartObject co in ChartControl.ChartObjects)
{
    // do your stuff here
    Print(co.Y.ToString());
}

Yes, but a line has a StartY and EndY and here I get only the start Y value.

Reply With Quote
 
  #18 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received


AlBundy View Post
Yes, but a line has a StartY and EndY and here I get only the start Y value.

Which is why you need the DrawObject list to get an object that you can treat as an ILine which does have startY and endY, and can match tags with the ChartObjects list if you want to.

[you showed greg's code again, not the two versions I gave you, there is information in both and you need to get more information from the manual]

Cheers

Travel Well
Reply With Quote
The following user says Thank You to ratfink for this post:
 
  #19 (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


ratfink View Post
Yes, that's why I gave you the earlier example showing the 'ToString("0.00000") to get 5 places.

And look in the Ninja manual to see them using ILine objects from the DrawObjects list.

Ratfink, you are the best!

In the ILine object is StartY and EndY and the values are double --> the values are exact and with them I can re-draw the lines!

For me the case closed! Again thank you very much. I did not know about the ILine object!

UPDATE:
When you iterate through DrawObjects you have to check which type the object is and then cast it to the according object. Example:

 
Code
            foreach ( IDrawObject oItem in DrawObjects )
            {
                switch ( oItem.DrawType )
                {
                    case DrawType.Line:
                        ILine oLine = (ILine) oItem;
                        Print(string.Format("Found Line:{0:G} - StartY:{1:0.00000} - EndY:{2:0.00000}", oLine.Tag, oLine.StartY, oLine.EndY));
                        break;
                    case DrawType.Text:
                        IText oText = (IText) oItem;
                        Print(string.Format("Found Text:{0:G} - '{1:G}' - Y:{2:G}", oText.Tag, oText.Text, oText.Y));
                        break;
                }
            }


Last edited by AlBundy; February 14th, 2015 at 03:41 PM. Reason: Additional information for the programmer
Reply With Quote
The following user says Thank You to AlBundy for this post:

Reply



futures io > > > > > Get all draw objects

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
Fib extenions I can draw ricktrades ThinkOrSwim 3 July 7th, 2014 02:38 PM
Little help with Draw Region jram77 NinjaTrader Programming 14 September 26th, 2013 12:21 AM
Flashing signal objects in NT7 aligator Traders Hideout 5 January 31st, 2011 11:35 PM
How to draw a 2d map ?!? paolopoletti NinjaTrader Programming 3 January 17th, 2011 02:42 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 06:52 PM.

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.12 seconds with 20 queries on phoenix via your IP 54.90.92.204