Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add ISeries together ie Open+High+Low+Close

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

    How to add ISeries together ie Open+High+Low+Close

    What is the best way to add ISeries objects together using addition to create a new ISeries object?

    I am trying to pass in OHLC/4 to the moving average indicators as the input source data. I see Weighted is HLCC/4, Typical is HLC/3, and Median is HL/2 but I don't see a PriceSeries for OHLC/4.

    This gives a compile error: MovAvgTrendValue = EMA((Open+High+Low+Close)/4.0,MovAvgTrendPeriod)[0];

    #2
    Hello zagier,

    Thank you for your post.

    You would need to create your own custom series where each value is the O+H+L+C / 4. Then you can pass that series into your indicator.

    For example,

    Code:
    private Series<double> myDoubleSeries;
    
    //in State.DataLoaded
    myDoubleSeries = new Series<double>(this, MaximumBarsLookBack.Infinite);
    
    //in OnBarUpdate()
    myDoubleSeries[0] = (Open[0] + High[0] + Close[0] + Low[0]) / 4;


    Please let us know if you have any further questions.

    Comment


      #3
      Thanks...this helped me too.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X