Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling another indicator - data series

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

    Calling another indicator - data series

    What data series does it use when you call another indicator?

    The same one as the chart?

    How can you specify specifically another - say, you want to call another indicator on 200 ticks when the main indicator is on a 5 minute chart ?

    and is this code correct indicator.Value.GetValueAt(CurrentBar) to get the latest value?
    Last edited by NinjaCustomer; 05-07-2018, 10:15 AM.

    #2
    Hello NinjaCustomer,
    Thanks for your post.
    What data series does it use when you call another indicator?
    You are correct. Unless you specify for a different series to be used as the input then you will use the primary data series when calling an indicator. You are also correct that you could use that code for that purpose. For example, both of the following prints will produce the same value.
    Code:
    Print(SMA(20).Value.GetValueAt(CurrentBar));
    Print(SMA(20)[0]);
    How can you specify specifically another - say, you want to call another indicator on 200 ticks when the main indicator is on a 5 minute chart ?
    Something similar to the following snippet would add a 200 tick series, and then use that 200 tick series as an input to the SMA using BarsArray.
    Code:
    protected override void OnStateChange()
    {
    	else if (State == State.Configure)
    	{
    		AddDataSeries(BarsPeriodType.Tick,200);
    	}
    }
    protected override void OnBarUpdate()
    {
    	Print("The Primary Data Series' SMA(20) = "+SMA(BarsArray[0],20)[0]); 
            Print("My 200 Tick SMA(20) = "+SMA(BarsArray[1],20)[0]);
    }
    Please see the following help guide document for more information on BarsArray.
    Help Guide - BarsArray

    Please let me know if you have any questions.
    Josh G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    589 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    342 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    555 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X