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 algospoke, Yesterday, 06:40 PM
          2 responses
          23 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          45 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          22 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          181 views
          0 likes
          Last Post jeronymite  
          Working...
          X