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 SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      35 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      13 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      19 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      22 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X