Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

int series for indicator gives compiler error

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

    int series for indicator gives compiler error

    I have a custom indicator with two data series I want to make available. I only want to plot the default series (which I call "TrendMode") but I want my strategy (in another file) to be able to access the second series (which I call "PendingCount"

    In my indicator file I declare the properties like this:

    Code:
    #region Properties
    
    [Browsable(false)]
    [XmlIgnore()]
    public Series<int> PendingCount
    {
        get { return Values[1]; }
    }
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> TrendMode
    {
        get { return Values[0]; }
    }
    #endregion
    However, the PendingCount series gives me a compiler error:
    Cannot implicitly convert type 'NinjaTrader.NinjaScript.Series<double> ' to 'NinjaTrader.NinjaScript.Series<int>'
    I don't understand why it thinks this is Series<double> instead of Series<int>. How do I fix this?

    #2
    Hello westofpluto,

    Thank you for your post.

    PendingCount is returning a Series<double> value because you are calling get { return Values[1]; } and Values[ ] holds an array of Series<double> objects associated with plots. In order to expose indicator values that are not plots, you could create a Series<int> variable that stores information followed by accessing and expose that variable in the PendingCount property.

    Please review the SampleBoolSeries indicator example that demonstrates how to expose indicator values that are not plots - https://ninjatrader.com/support/help...alues_that.htm

    Also, here are help guide links for more information about Values [ ] and AddPlot.

    Values[ ] - https://ninjatrader.com/de/support/h...t8/?values.htm

    AddPlot - https://ninjatrader.com/support/help...8/?addplot.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    650 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    577 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X