Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Number of elements in data series

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

    #16
    gg80108,

    Set on every single bar. Take it one step at a time. I suggest you work with regular DataSeries and see how it works. When you do not set a value, the DataSeries will autopopulate with the close price so a zero is not coming from auto population. It is coming from either a Set or a Reset.
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      you got the code, don,t see where the problem is you talk about.. Think the auto populate is a 0 and not the close.

      Comment


        #18
        I have simplified your code and it is very clear why you receive zeroes. This is why I asked you to Print the values of the calculations before each set. It is very clear from the first screenshot that the values you are receiving come from a calculated zero as the math makes it zero. You are subtracting the current PnL total from the PnL stored for the prior session. As you start a new session you have not made any trades yet so the current PnL is still the same as the stored one from yesterday. This means you get zero. You will continue to get zero until you successfully make a trade for the new session.
        Attached Files
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          If I totally comment out the set statement and the reset, the array fills with 0's..

          Comment


            #20
            gg80108,

            Please take a look at the reference I just posted in my previous post. Disregard auto fill. It is evident now that you receive zeroes from not having any trades on the new session. You will notice that you only get these zeroes as you switch to a new session and have not completed any new trades yet.
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              I experimented with your sampleCustomDataSeries,, I commented out the SET and printed the results . Just isnt the close of the bar but just random and if you round it off it becomes 0..

              /* Take note that the method for setting the value to be plotted is the same as for setting a value
              to a DataSeries object. The difference here is that the custom DataSeries object is not plotted while
              this "AvgR" is plotted.

              In this case we are plotting the Simple Moving Average of the intermediate calculation step stored in our
              DataSeries object. */

              // AvgR.Set(SMA(myDataSeries, Period)[0]);
              Print ("myDataSeries value: "+ myDataSeries[0] + " bar # " +Bars.BarsSinceSession);

              Output window
              myDataSeries value: 0.299999999999955 bar # 7
              myDataSeries value: 0.399999999999977 bar # 8
              myDataSeries value: 0.399999999999977 bar # 9
              myDataSeries value: 0 bar # 10
              myDataSeries value: 0 bar # 11
              myDataSeries value: 0 bar # 12
              myDataSeries value: 0.399999999999977 bar # 13
              myDataSeries value: 0.199999999999989 bar # 14
              myDataSeries value: 0.399999999999977 bar # 15
              myDataSeries value: 0.300000000000011 bar # 16
              myDataSeries value: 0.399999999999977 bar # 17
              myDataSeries value: 0.300000000000011 bar # 18
              myDataSeries value: 0.399999999999977 bar # 19
              myDataSeries value: 0.399999999999977 bar # 20
              myDataSeries value: 0.399999999999977 bar # 21
              myDataSeries value: 0.300000000000011 bar # 22
              myDataSeries value: 0.399999999999977 bar # 23
              myDataSeries value: 0.399999999999977 bar # 24
              myDataSeries value: 0.399999999999977 bar # 25
              myDataSeries value: 5.6843418860808E-14 bar # 26
              myDataSeries value: 0.0999999999999659 bar # 27
              myDataSeries value: 0.299999999999955 bar # 28
              myDataSeries value: 0.399999999999977 bar # 29
              myDataSeries value: 0.399999999999977 bar # 30
              myDataSeries value: 0.0999999999999659 bar # 31
              myDataSeries value: 0.399999999999977 bar # 32
              myDataSeries value: 0.399999999999977 bar # 33
              Last edited by gg80108; 04-20-2009, 09:43 AM.

              Comment


                #22
                gg80108,

                In my previous post I stated to disregard that thought process. It does not apply in this situation and is actually for plot DataSeries and not custom DataSeries.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                574 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                332 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
                553 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X