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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    56 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    35 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    57 views
    0 likes
    Last Post PaulMohn  
    Working...
    X