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

Indicator from NT7 to NT8

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

    Indicator from NT7 to NT8

    Hi, The code below is fine in NT7, but it is not good in NT8, how to fix it?
    The code is:

    #region Properties
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries Top //line 271
    {
    get { return Values[0]; } //line 271
    }
    The error message is:

    Line 271: Expected class, delegate, enum, interface, or stuct
    Line 273: Identifier expected
    Line 273: Type or namespacde definition, or end-of-file expected

    #2
    Hello LadGta2018,

    Thanks for the post.

    You can define a public series property like so:

    Code:
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> Plot1
    {
    	get { return Values[0]; }
    }
    The code-breaking changes page is a good place to find where code changes took place between NinjaTrader 7 and 8:



    If we may be of any further assistance, please let us know.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your quick response. That is what I thought.

      But the same error still there. Is there any wrong with my code?


      AddPlot(new Stroke(Brushes.Red), PlotStyle.Dot, "Top");

      #region Properties
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public Series<double> Top
      {
      get { return Values[0]; }
      }

      Comment


        #4
        Hello LadGta2018,

        Thanks for the reply.

        Make sure you call AddPlot within State == State.SetDefaults.

        Kindly see the attached example.

        Please follow these directions to import the example:


        Please let me know if you have any additional questions.
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Thanks, I found the reason. When I copy and paste, there are a few "}" before these lines.

          Thanks for the help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by merzo, 06-25-2023, 02:19 AM
          10 responses
          823 views
          1 like
          Last Post NinjaTrader_ChristopherJ  
          Started by frankthearm, Today, 09:08 AM
          5 responses
          15 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          43 views
          0 likes
          Last Post jeronymite  
          Started by yertle, Today, 08:38 AM
          5 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by adeelshahzad, Today, 03:54 AM
          3 responses
          19 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X