Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Thanks...this helped me too.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by john_44573, Today, 12:55 PM
      4 responses
      29 views
      0 likes
      Last Post john_44573  
      Started by IDumpedCinderella, Today, 07:39 AM
      4 responses
      19 views
      0 likes
      Last Post IDumpedCinderella  
      Started by defa0009, Today, 09:33 AM
      10 responses
      24 views
      0 likes
      Last Post defa0009  
      Started by sultanofsuede, 09-16-2024, 09:31 PM
      10 responses
      33 views
      0 likes
      Last Post sultanofsuede  
      Started by paulo_br, Today, 12:11 PM
      2 responses
      16 views
      0 likes
      Last Post paulo_br  
      Working...
      X