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

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 nicthe, Today, 02:58 PM
        1 response
        8 views
        0 likes
        Last Post nicthe
        by nicthe
         
        Started by percy3687, Yesterday, 12:28 AM
        3 responses
        30 views
        0 likes
        Last Post percy3687  
        Started by SilverSurfer1, Today, 01:33 PM
        0 responses
        9 views
        0 likes
        Last Post SilverSurfer1  
        Started by ETFVoyageur, Today, 10:27 AM
        2 responses
        18 views
        0 likes
        Last Post ETFVoyageur  
        Started by CommonWhale, Today, 01:12 PM
        0 responses
        11 views
        0 likes
        Last Post CommonWhale  
        Working...
        X