Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT 8.1.2.0 code (BarLine as IDrawingTool).ZOrder = int.MaxValue; gives error

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

    NT 8.1.2.0 code (BarLine as IDrawingTool).ZOrder = int.MaxValue; gives error

    On Version 8.0.28.0, the following code compiles without error, however, when I migrated the code over to 8.1.2.0, it gives me an error: ')' expected. The error is on the second line of the code (BarLine as IDrawingTool).ZOrder = int.MaxValue; Anyone know why this code generated this error?

    NinjaTrader.NinjaScript.DrawingTools.Line BarLine = Draw.Line(this, tag, isAutoScale, startBarsAgo, startY, endBarsAgo, endY, brush, dashStyle, width);

    (BarLine as IDrawingTool).ZOrder = int.MaxValue;​

    #2
    Hello hotsalamii,

    Welcome to the NinjaTrader forums!

    The error that a closing parenthesis ')' is expected may imply that the syntax in the code above this point is incorrect somewhere.

    Also, it may not be necessary to cast this to IDdrawingTool to set the ZOrder as it is already a drawing tool.

    BarLine.ZOrder = int.MaxValue;
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I don't understand either why you would cast it to an IDrawingTool. It's already a Line which has more capabilities than an IDrawingTool so you're making it harder on yourself than necessary. Just change the line's ZOrder. There's no need to cast it at all.
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment


        #4
        I removed the typecast from the code and it compiled fine. I am still curious as to why the error message about the error: ')' expected when trying to typecast.
        Thanks for the comment @NinjaTrader_ChelseaB​ and @QuantKey_Bruce

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        597 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        555 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X