Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error CS0246 when adding a DataSeries?

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

    Error CS0246 when adding a DataSeries?

    Hi All. I am trying to add a DataSeries for Position.AveragePrice and getting this error.
    The type or namespace name 'DataSeries' could not be found (are you missing a using directive or an assembly reference?) CS0246 69 11


    Code
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.Indicators;
    using NinjaTrader.NinjaScript.DrawingTools;​

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class test : Strategy
    {
    private DataSeries BreakevenSeries;


    and then
    else if (State == State.Configure)
    {
    BreakevenSeries = new DataSeries(this);


    What am I missing?

    Thank​

    #2
    Please check this link , https://ninjatrader.com/support/help...price_data.htm. It might help.
    you've got these below :

    BreakevenSeries =new BreakevenSeries(this)

    private Series<double> myDoubleSeries;

    AddDataSeries(BarPeriodType.Seconds,3);
    Last edited by Emma1; 10-08-2023, 02:07 PM.

    Comment


      #3
      Hi, the link that you provided does not work. I am also having this same issue with creating a data series.

      Comment


        #4
        DataSeries was deprecated. I fixed the code using

        private Series<double> realBreakeven;

        and then

        else if (State == State.Configure)
        {
        realBreakeven = new Series<double>(this);

        Hope it helps.


        Comment


          #5
          Hello tradebot,

          Emma1 is correct. NinjaTrader 8 uses a Series<T> object, the T in this would represent Type, as any data type can be stored in a series. In your case to store prices this would be a Series<double>.

          Below is a link to the help guide.


          Try using the Strategy Builder to add a custom series, and the view the code generated by clicking the View Code button.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          42 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          20 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          29 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          46 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          38 views
          0 likes
          Last Post CarlTrading  
          Working...
          X