Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 LawrenHom, Today, 10:45 PM
        0 responses
        3 views
        0 likes
        Last Post LawrenHom  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        7 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Working...
        X