Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 TraderBCL, Today, 04:38 AM
            2 responses
            11 views
            0 likes
            Last Post TraderBCL  
            Started by martin70, 03-24-2023, 04:58 AM
            14 responses
            105 views
            0 likes
            Last Post martin70  
            Started by Radano, 06-10-2021, 01:40 AM
            19 responses
            606 views
            0 likes
            Last Post Radano
            by Radano
             
            Started by KenneGaray, Today, 03:48 AM
            0 responses
            4 views
            0 likes
            Last Post KenneGaray  
            Started by thanajo, 05-04-2021, 02:11 AM
            4 responses
            471 views
            0 likes
            Last Post tradingnasdaqprueba  
            Working...
            X