Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Nt7 to NT8 Translation examples

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

    Nt7 to NT8 Translation examples

    I am looking for code examples of scripts in both languages so I can compare the and analyze the translation utility behavior. I am under the impression I once saw a post on this with examples but I can't locate it.
    Thank you
    G

    #2
    Hello giogio1,

    Thank you for your post.

    The Help Guide page below documents NinjaScript changes you can expect between NinjaTrader 7 and NinjaTrader 8.



    You can also compare the Help Guide pages for NT7 and NT8.

    NT8 NinjaScript Language Reference: https://ninjatrader.com/support/help...erence_wip.htm

    Please let us know if you have any further questions.

    Comment


      #3
      There is a conversion method spread all over the forum, but is limitted and does not cover a full translation, just for simple things. You can do searches for conversion key words.

      Meanwhile, NinjaTrader_Gaby could you please provide a NT8 equivlent to this one line NT7 line causing an error CS1061 when compiled:

      Code:
      tstr = "123Up1," + obName.Substring(7);
      drawObject = DrawObjects[tstr];
      if (drawObject != null && drawObject.DrawType == DrawType.Text)  
      {
      Text text = (Text) drawObject;
      text.Y = yp;
      yp -= textOffset;
      }​
      Thanks.
      Last edited by aligator; 07-01-2024, 08:53 AM.

      Comment


        #4
        Hello alligator,

        What is this code trying to do? If you are trying to identify a drawing object by its tag and type, use the following:

        if (DrawObjects["someTag"] != null && DrawObjects["someTag"] is DrawingTools.Text)
        {
        // Do something with the drawing tool text
        }

        Comment


          #5
          Originally posted by NinjaTrader_Gaby View Post
          Hello alligator,

          What is this code trying to do? If you are trying to identify a drawing object by its tag and type, use the following:

          if (DrawObjects["someTag"] != null && DrawObjects["someTag"] is DrawingTools.Text)
          {
          // Do something with the drawing tool text
          }

          https://ninjatrader.com/support/help...rawobjects.htm
          Thanks NinjaTrader_Gaby! The line script you noted works fine now.

          Correct. The above script is to simply provide a Y offset location for the Text (one of several tags in a NT7 indicator)

          The second line form the bottom ( text.Y = yp) is part of the error that was not listed before. Could you please comment on the last 3 lines in post #3, specifically how text.Y = yp; is handled in NT8. Sorry, but I did not find any documentation.

          Mant thanks.
          Last edited by aligator; 07-01-2024, 01:28 PM.

          Comment


            #6
            Hello alligator,

            It sounds like you might be looking for the YPixelOffset.

            YPixelOffset - An int value representing the offset value in pixels from within the text box area

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            566 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 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
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X