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.
    https://ninjatrader.com/support/help...assemblies.htm

    And a public link to the help guide on DrawObjects.
    https://ninjatrader.com/support/help...rawobjects.htm
    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 Walter2011, Today, 08:27 AM
        2 responses
        5 views
        0 likes
        Last Post Walter2011  
        Started by arangocj, Today, 06:28 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by BIllblast, Today, 08:03 AM
        4 responses
        13 views
        0 likes
        Last Post BIllblast  
        Started by jerryblack, Yesterday, 05:04 PM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by mattage86, Today, 06:43 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Working...
        X