Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exception thrown with custom indicator column

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

    exception thrown with custom indicator column

    I am trying to create a column in MA using a custom indicator.

    I am getting an error: Error on accessing plot series 'Status' for indicator 'MyCustomIndicator': Exception has been thrown by the target of invocation.

    I have added a plot to the indicator and have a property called "Status" for the DataSeries that returns Values[0] (its the only plot).

    Any ideas why this error is coming up?

    One thing to note that is strange: When I went to add the plot, I could not get it to compile with this line:

    Code:
    Add(new Plot(Color.Black, "Status"));
    I had to add the full path like this to get it to compile.
    Code:
    Add(new NinjaTrader.Gui.Chart.Plot(Color.Black, "Status"));
    I've used the add method 100's of time and never had this type of behavior - though the indicator compiles, could this have anything to do with the exception?

    #2
    Hello,
    Thank you for the question.

    Could you post the script for this? Based on the error it sounds like the indicator is not inheriting from the indicator base.

    If You can post either the code or a sample of the code body I could tell you more.

    If you do not wish to post your script publicly please continue this conversation with me through our support at platformsupport @ ninjatrader.com and reference the ticket #1245327

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      unfortunately I can't post the code. sending an email.

      Comment


        #4
        A little more digging and I figured out why I needed to have the full path the to plot - I as missing the using statement which is usually there for my other indicators.

        Anyways, I am still getting the same exception in MA.

        Comment


          #5
          found the issue and just posting back here for others.

          My property looks like this:

          Code:
          [Browsable(false)]
                  [XmlIgnore()]
                  public DataSeries Status
                  {
                      get 
                      {
                          Update();
                          Print("get status " + Values[0][0]);
                          return Values[0];
                      }
                  }
          When the script starts, the property gets accessed before OnStartUp and before OnBarUpdate.
          So when it reaches that Print statement, an exception gets thrown because Values is not yet initialized. I am assuming this flow is specific to MA. Anyways, removed the print statement and all works well.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by helpwanted, Today, 03:06 AM
          1 response
          7 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          7 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          5 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          242 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          385 views
          1 like
          Last Post Gavini
          by Gavini
           
          Working...
          X