Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT7 to NT8 Code Changes

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

    NT7 to NT8 Code Changes

    Hello

    Can you please help me transfer my code from NT7 to NT8 on some code parts which I did not succeed:

    1) if (itrDrawObject.DrawType == DrawType.VerticalLine)
    itrDrawObject used to be of type IDrawObject. I changed it to IDrawingTool but there are still errors.

    2) if (verticalLine.Pen.Color == Color.Red)
    verticalLineused to be of type IVerticalLine. I changed it to VerticalLinebut there are still errors.

    3)verticalLine.Time
    Again, verticalLineused to be of type IVerticalLine. I changed it to VerticalLinebut there are still errors.

    #2
    Hello kiss987,

    You haven't provided the needed context of how these are being declared.

    While you could cast as DrawingTool and compare this with DrawingTools.VerticalLine, if you plan to export this as a dll you would need to cast as dynamic types.

    Below is a public link to the help guide which details and provides example code on casting as dynamic.


    And a public link to the help guide on DrawObjects.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello

      I was able to convert sample 2 into:
      verticalLine.Pen.Color > verticalLine.Stroke.Brush

      However, I cannot find a way to make sure if it's red. When I print it to screen i get '#FF000000' which represents red, but I don't want to compare it to a string.

      Thanks

      Comment


        #4
        Hello kiss987,

        Not all brushes will have a standard color.

        You could do a comparison, however.

        if (verticalLine.Stroke.Brush == Brushes.Red)
        {
        // execute code
        }
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        42 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
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X