Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

adding together different indicators

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

    adding together different indicators

    Apologies if this has been asked before.

    How can I create an indicator that is the sum of other indicators of other data series?

    e.g new indicator = MA (data series 1) + MA (data series 2).....MA (data series n)

    Thanks.

    #2
    Hello SparkyBoy,

    You may do this by using the BarsArray object when using a Multiseries script for example:


    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Sum"));

    Add("MSFT",PeriodType.Day,1); //BarsArray 1
    Add("GOOG",PeriodType.Day,1); //BarsArray 2
    }

    protected override void OnBarUpdate()
    {
    // Check to make sure that you have enough data in all series
    if (CurrentBars[0] <= 1 || CurrentBars[1] <= 1 || CurrentBars[2] <= 1)return;

    if(BarsInProgress == 0)
    Sum.Set(SMA(BarsArray[1],14)[0]+SMA(BarsArray[2],14)[0]);
    }

    Here is a link to our Help Guide that talk about Multiseries scripts in more detail that you may view.


    Let me know if that will work for what you are looking for.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 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
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X