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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        92 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        122 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X