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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        41 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        29 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        46 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        37 views
        0 likes
        Last Post CarlTrading  
        Working...
        X