Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I add an indicator on another time series

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

    Can I add an indicator on another time series

    Hi,
    I'm trying to add an indicator on another time series in a strategy like:
    Add(PeriodType.Minute, 15);
    Add(SMA(Closes[1],20));
    Why doesn't it work?

    Baruch

    #2
    Baruch, when you add an indicator, it will be active for all data series. There are two ways to use the specific time series though.

    First of all, you can simply call the indicator inside the appropriate bars in progress index. So, for example, if your primary data series is a 15 minute series, and you've added a 3 minute secondary series, you could get the SMA of the secondary data series in the second bars in progress index.
    Code:
    OnBarUpdate()
    {
       if (BarsInProgress == 1)
         // get secondary time series indicator information
    }
    The other way is to call the SMA with the secondary data series as the input data series anywhere in your code:
    Code:
    currentSecondarySMA = SMA(Closes[1], 20)[0];
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks Austin,
      The question is: can I plot a second data series indicator on a chart?
      With Add(...)
      Baruch

      Comment


        #4
        Baruch, unfortunately the direct method is unsupported. You can try to plot the data by using StrategyPlot, as demonstrated in this sample.
        AustinNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, Yesterday, 01:02 PM
        0 responses
        28 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        18 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        95 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X