Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Intraday Cumulative Values

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

    Intraday Cumulative Values

    I am attempting to create an intraday indicator that will zero out at the beginning of each day and then plot a cumulative total of (High+Low+Close)/3. The following code plots the correct (High+Low+Close)/3, but it does not plot a cumulative sum. Can anyone help me figure out what I am doing wrong?


    double cumulative=0;

    if (Bars.FirstBarOfSession && FirstTickOfBar)
    cumulative = 0;

    cumulative=cumulative+(High[0]+Low[0]+Close[0])/3;

    Plot0.Set(cumulative);


    Thanks in advance.

    Bob

    #2
    If all of that code is inside a single function, then "cumulative" is a local variable, getting set to zero each time the function is called. Try making it either static or a class variable.

    --EV

    Comment


      #3
      Hello,

      If ETF idea does work, I would need to see your entire code block.

      For example not sure what

      double cumulative=0;


      This is doing, Is this inside OnBarUpdate() (If So its the problem)or are you just showing my how you decared it in the variable section?

      I look forward to assisting you further.
      BrettNinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 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
      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