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 NullPointStrategies, Today, 05:17 AM
          0 responses
          20 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          119 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          63 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          45 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X