Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Errors in implementing DataSeries

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

    Errors in implementing DataSeries

    Here is some code I borrowed from this forum :

    private int AskTotCumulativeVolume;
    AskTotCumulativeVolume = e.MarketDepth.Ask.TotalVolume(5);

    this is the code I compiled and the error message I got :

    private DataSeries averageAsk;
    averageAsk = new DataSeries(this);
    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries Plot0
    {
    get { return Values[6]; }
    }
    averageAsk.Set(SMA(AskTotCumulativeVolume, 10));
    Argument '1': cannot convert from 'int' to 'NinjaTrader.Data.IDataSeries'
    Plot0.Set(averageAsk);
    Argument '1': cannot convert from 'NinjaTrader.Data.DataSeries' to 'double'

    Please, let me know what I should do to have that SMA plotted ?

    #2
    Try:

    averageAsk.Set(SMA(AskTotCumulativeVolume, 10)[0]);
    Plot0.Set(averageAsk[0]);
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi Ray,

      Sorry to let you know, I have one error left :

      averageAsk.Set(SMA(AskTotCumulativeVolume, 10)[0]);
      Argument '1': cannot convert from 'int' to 'NinjaTrader.Data.IDataSeries'

      Comment


        #4
        AskToCummulativeVolume is of type 'int' and not of type 'IDataSeries'. You can not pass into the SMA() method the variable AskToCummulativeVolume. You need to store this data in a DataSeries object.

        Additional information - http://www.ninjatrader-support.com/H...iesObject.html
        RayNinjaTrader Customer Service

        Comment


          #5
          Is it possible to create a DataSeries object that is not synced with historical data bars and use it like an array?
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Nope. Just use e.g. an ArrayList.

            Comment

            Latest Posts

            Collapse

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