Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom DataSeries

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

    Custom DataSeries

    As per your code breaking document, I am setting a value for the DataSeries on each bar. The following code gives me different results depending if I run it on 6.5 or 7. Any ideas?

    if (Close[0] >= Open[0])
    {
    upVl.Set(Volume[0]);
    if (upVl[0] < 1)
    { upVl.Set(1); }
    }
    else
    {
    dnVl.Set(Volume[0]);
    if (dnVl[0] < 1)
    { dnVl.Set(1); }
    }

    double val1 = (WMA(WMA(upVl, 10),5)[0]);
    double val2 = (WMA(WMA(dnVl, 10),5)[0]);

    Print("val1 = "+val1.ToString("0.00"));
    Print("val2 = "+val2.ToString("0.00"));
    Attached Files

    #2
    BradB, have you tried on infinite lookback for the dataseries on NT7 to be comparing to NT65?

    Comment


      #3
      Yes, it bombs as it does anytime I try to use the infinite option.

      2010-05-07 11:46:29:328 ********* exception trapped *********
      2010-05-07 11:46:29:328 Index was out of range. Must be non-negative and less than the size of the collection.

      Comment


        #4
        more info

        Ok, aside from the seperate "infinite" issue, a very simple indicator is giving entirely different results between the 2 versions. I updated the example code to change val1 and val2 from doubles to DataSeries. Running them with default 256 limit. I also print the current bars volume. The volume matches up on each different version of Ninja, but the val1 and val2 Dataseries print entirely different numbers. The infinite option should not come into play here at all, nothing is looking back that far. I have attached the sample code.
        Attached Files

        Comment


          #5
          Hi Brad, on infinite I can't reproduce your issues when I'm adding those defaults for the custom data series values you created -

          Code:
          val1.Set(0);
          			val2.Set(0);
          			upVl.Set(0);
          			dnVl.Set(0);
          This is new for NT7, you should set a value for each bar (even if it's dummy) as otherwise you could run into exceptions.

          For the calculated values - have you compared for example using the Default 24 / 7 template to replicate NT 65's session settings on the charts?

          Comment


            #6
            Thanks Bertrand, concerning infinite, what I wasn't doing was setting a value in my beginning return

            if (CurrentBar < 12)
            return;

            Apparently I have to set a value, even for those bars.

            As far as the version using 256, I an using a 12:00am to 12:00am chart on NT6.5 and the 24/7 template on NT7. It shouldn't even matter though, I'm only looking at Volume for the last few bars which does match on both when I print it. Did you run the attached code on both systems?

            Comment


              #7
              Hi Bertrand,

              I have it working now. Just changed my code to initialize the DataSeries 1st thing EVERY bar, before anything else takes place.

              protected override void OnBarUpdate()
              {
              val1.Set(0);val2.Set(0);upVl.Set(0);dnVl.Set(0);
              if (CurrentBar < 12)
              { return; }
              .
              .
              .
              }

              Comment

              Latest Posts

              Collapse

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