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!
See more
See less

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
          BertrandNinjaTrader Customer Service

          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 Irukandji, Today, 09:34 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by RubenCazorla, Today, 09:07 AM
            1 response
            5 views
            0 likes
            Last Post RubenCazorla  
            Started by TraderBCL, Today, 04:38 AM
            3 responses
            25 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            11 responses
            1,423 views
            0 likes
            Last Post jculp
            by jculp
             
            Started by BarzTrading, Today, 07:25 AM
            2 responses
            29 views
            1 like
            Last Post BarzTrading  
            Working...
            X