Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Acessing draw values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Acessing draw values

    Hi guys, I have an indicator that draws support and resistance on the chart. I looked at the code and saw this:

    DrawRectangle("resZone"+level, false, 0, p-((zoneTickSize*TickSize)/2), maxLookBackBars, p+((zoneTickSize*TickSize)/2), colorAbove, colorAbove, 3);
    DrawLine ("resLine"+level, false, 0, p-((zoneTickSize*TickSize)/2), maxLookBackBars, p-((zoneTickSize*TickSize)/2), colorAbove, DashStyle.Solid, 1);

    I've also attached a picture of the datapoints from the chart. What I want to do is say if

    Close[0] > resLin1 Start Y

    <do something>

    The problem is insteading of calling it resline1 it is resline+ level. I see there is a start Y and end Y so is it possible to access that somehow?

    Unfortunately I cannot copy the whole code as it is proprietary to another member.

    Thanks
    DJ



    Any ideas on how to achieve this would be appreciated.
    Attached Files

    #2
    Originally posted by djkiwi View Post
    Hi guys, I have an indicator that draws support and resistance on the chart. I looked at the code and saw this:

    DrawRectangle("resZone"+level, false, 0, p-((zoneTickSize*TickSize)/2), maxLookBackBars, p+((zoneTickSize*TickSize)/2), colorAbove, colorAbove, 3);
    DrawLine ("resLine"+level, false, 0, p-((zoneTickSize*TickSize)/2), maxLookBackBars, p-((zoneTickSize*TickSize)/2), colorAbove, DashStyle.Solid, 1);

    I've also attached a picture of the datapoints from the chart. What I want to do is say if

    Close[0] > resLin1 Start Y

    <do something>

    The problem is insteading of calling it resline1 it is resline+ level. I see there is a start Y and end Y so is it possible to access that somehow?

    Unfortunately I cannot copy the whole code as it is proprietary to another member.

    Thanks
    DJ



    Any ideas on how to achieve this would be appreciated.
    If you need to access only the last rectangle, store the tag in a global string variable, when you draw the rectangle. You can then access the tag by reading the contnets of the string variable. If you need to access earlier rectangles, you may want to store the tags in an ArrayList.

    Comment


      #3
      Rectangles

      Hi and Thanks Koganam. This looks interesting.

      "If you need to access earlier rectangles, you may want to store the tags in an ArrayList".

      The options are available to draw up to 3 support and resistance lines so it maybe resline 1, resline 2 and resline 3. Would you be able to provide some pointers on how to do this? I'm not even sure where to start.

      Thanks. DJ

      Comment


        #4
        Rectangle access

        Hi guys, can anyone else help with this one? I realize I only need access to the most recent rectangle. The name Resline1 is on the chart (see attached picture) so wondering how to access it?

        Thanks
        DJ

        Comment


          #5
          DJ, you would access your drawn objects through this collection - http://www.ninjatrader.com/support/h...rawobjects.htm

          Or through the IDrawObject interface of your rectangle if drawn programmatically - http://www.ninjatrader.com/support/h...irectangle.htm

          Comment


            #6
            Originally posted by djkiwi View Post
            Hi guys, can anyone else help with this one? I realize I only need access to the most recent rectangle. The name Resline1 is on the chart (see attached picture) so wondering how to access it?

            Thanks
            DJ
            So it appears then that what you really want is to access the last LINE, not rectangle?

            The easiest way will be for you to draw a second line that is a duplicate of the first, but named, with a fixed tag, and transparent, then access that line for properties.

            Code:
            private ILine ReferenceLine = null; //(in variables section)
            Code:
            ReferenceLine = DrawLine("ResLine", false, 0, p-((zoneTickSize*TickSize)/2), maxLookBackBars, p-((zoneTickSize*TickSize)/2), Color.Transparent, DashStyle.Solid, 1);
            You can then access the value you want by:

            ReferenceLine.StartY as a double.
            Last edited by koganam; 04-28-2011, 11:55 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            574 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            333 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            553 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X