Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DataSeries, IDataSeries or MIN MAX?

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

    DataSeries, IDataSeries or MIN MAX?

    Hi

    I'm trying to 'record' the highest and lowest reading for an indicator (MACD) but only once a set of conditions are met. Once I have the high or low I need to use them in IF statements.

    I've played around with DataSeries, IDataSeries and MIN MAX but wondered if there was an established approach?

    Thanks in advance

    #2
    Hello,

    Thank you for your post.

    Have you tried the HighestBar() and Lowest() Bar methods?

    This will return the highest and lowest value within the period you have specified.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi Matthew,

      It's not really how the levels are being recorded (I've opted for SwingLow as per the example below), It's how I can limit the dataseries to storing the data only when a set of conditions are met.

      This approach seems to work but I wondered if there is a recommended approach

      if (MACD(12, 26, 9).Diff[0] > MACD(12, 26, 9).Diff[1]
      && MACD(
      12, 26, 9).Diff[0] > Swing(MACD(12, 26, 9).Diff, 0).SwingLow[0]
      {
      mACDhistlow.Set(Swing(MACD(
      12, 26, 9).Diff, 0).SwingLow[0]);
      Print(mACDhistlow[
      0].ToString("Swing 0.0000000"));
      }

      Comment


        #4
        Hello,

        I see no problem with this. You're storing the value in a DataSeries object which will allow you to access this for later. This is essentially the same approach that is being used in our reference sample on this subject:

        MatthewNinjaTrader Product Management

        Comment


          #5
          Matthew,

          That's reassuring - thanks for the review

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          579 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 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
          554 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