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 sidlercom80, 10-28-2023, 08:49 AM
            168 responses
            2,262 views
            0 likes
            Last Post sidlercom80  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by WeyldFalcon, 12-10-2020, 06:48 PM
            14 responses
            1,429 views
            0 likes
            Last Post Handclap0241  
            Started by DJ888, 04-16-2024, 06:09 PM
            2 responses
            9 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            41 views
            0 likes
            Last Post jeronymite  
            Working...
            X