Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IDrawingObjectds Conversion to NT8

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

    IDrawingObjectds Conversion to NT8

    Dear Support:

    Considering that IDrawObjects is not used in NT8, converting the following few lines from NT7 to NT8 present a challenge to non-programmers. I could not find any documentation or code breaking information on how to deal with IDraw related codes.

    Would a kind sole please provide some insight and/or suggest a translation to NT8 for the following script?

    Code:
     			foreach(IDrawObject o in DrawObjects)
    			{
    				if(o.Tag.Contains("supZone") || o.Tag.Contains("demZone"))
    				{
    					if(o.DrawType == DrawType.Rectangle)
    					{
    						IRectangle rec = (IRectangle)o;
    						rec.EndBarsAgo = 0;
    					}
    					if(o.DrawType == DrawType.Line)
    					{
    						ILine lin = (ILine)o;
    						lin.EndBarsAgo = 0;
    					}
    					if(o.DrawType == DrawType.Text)
    					{
    						IText txt = (IText)o;
    						txt.BarsAgo = 0;
    					}
    				}
    			}
    Many thanks.

    #2
    Hello Aligator,

    Please see Jessica's sample at the following link which demonstrates what you're looking to do.



    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello Aligator,

      Please see Jessica's sample at the following link which demonstrates what you're looking to do.



      Please let us know if you need further assistance.
      Thanks Alan,

      I used NinjaTrader_JessicaP script and was able to fix the IDraw issue. However, the second lines under the 3 IF statements generate errors since NT8 does not recognize the x locations EndBarsAgo and BarsAgo in the IF statements. See below modified code:

      Code:
       			foreach(DrawingTool o in DrawObjects)
      			{
      				if(o.Tag.Contains("sup") || o.Tag.Contains("res"))
      				{
      					if (o is DrawingTools.Rectangle)					
      					{
      						Rectangle rec = (Rectangle)o;
      						rec.EndBarsAgo = 0;
      					}
      					
      					if (o is DrawingTools.Line)					
      					{
      						NinjaTrader.NinjaScript.DrawingTools.Line lin = (NinjaTrader.NinjaScript.DrawingTools.Line)o;
      						lin.EndBarsAgo = 0;
      					}
      
      					if (o is DrawingTools.Text)					
      					{
      						Text txt = (Text)o;
      						txt.BarsAgo = 0;
      					}
      				}
      			}
      The statements with BarsAgo and EndBarsAgo generate error since they are not defined in NT8 as extensions for DawingTools obects extensions.

      What would be the code breaker or the NT8 version for the following three lines, please:

      Code:
       						rec.EndBarsAgo = 0;
      						lin.EndBarsAgo = 0;
      						txt.BarsAgo = 0;
      Many Thanks.

      Comment


        #4
        Hello,

        You could set the drawing object's parameter for end bars with the following,

        Code:
        rec.EndAnchor.BarsAgo=0;
        See the following section of our helpguide,


        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_AlanP View Post
          Hello,

          You could set the drawing object's parameter for end bars with the following,

          Code:
          rec.EndAnchor.BarsAgo=0;
          See the following section of our helpguide,


          Please let us know if you need further assistance.
          Thanks a bunch Alan,

          You have been so wonderful helping me.

          The last issue I have is converting the StartY and EndY values in the following line:

          Code:
           							if(Highs[barIndex][currBar] <= rec.StartY && Highs[barIndex][currBar] >= rec.EndY)
          Could you please comment if the following line (using Anchors) is the correct conversion as related to Y values?

          Code:
           							if(Highs[barIndex][currBar] <= rec.StartAnchor.Price && Highs[barIndex][currBar] >= rec.EndAnchor.Price)
          Again ,many thanks.

          Comment


            #6
            Hello aligator,

            Yes, the following would be the start Y point of the rectangle.
            Code:
            	rec.StartAnchor.Price
            And the end Y point of the rectangle would be,
            Code:
                 rec.EndAnchor.Price
            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by swestendorf, Today, 11:14 AM
            2 responses
            5 views
            0 likes
            Last Post NinjaTrader_Kimberly  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            4 responses
            13 views
            0 likes
            Last Post xiinteractive  
            Started by Mupulen, Today, 11:26 AM
            0 responses
            2 views
            0 likes
            Last Post Mupulen
            by Mupulen
             
            Started by Sparkyboy, Today, 10:57 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by TheMarlin801, 10-13-2020, 01:40 AM
            21 responses
            3,917 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Working...
            X