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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    54 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    34 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    94 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    56 views
    0 likes
    Last Post PaulMohn  
    Working...
    X