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

Indicator Data Series

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

    Indicator Data Series

    I want to get the values of an indicator from a different data series which I run on.
    For example, my strategy is running on a 10 range chart but I want to get the RSI values from a 200 range.

    Thanks

    #2
    Hello kiss987,

    Thank you for your note.

    I’ve attached a sample which will print to the output window the RSI of the secondary series added to the strategy which is a 1 range series.

    You would want to use the RSI Syntax which includes the ISeries, which is how you pass the indicator the secondary series.



    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      The RSI indicator uses only one data series as an input (Closes[1] in the example), so there's no problem.
      However, what if my custom indicator needs more than 1 input. For example, both Highs and Lows values.
      When my indicator takes the data from the chart directly there's no problem because I can simply use the High[x] and Low[x[ values, however I don't know how to get those values when I don't use the chart as a data series.

      Comment


        #4
        Hello kiss987,

        So I may provide you the best answer, would you be able to provide a sample indicator which takes two inputs?

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          Simple example:

          if (State == State.DataLoaded)
          {
          avg = new Series<double>(this);
          }


          protected override void OnBarUpdate()
          {
          avg[0] = (High[0] + Low[0]) / 2;
          }

          Comment


            #6
            Hello kiss987,

            To pass a series other than the primary series to an indicator you would use Highs[1] or Lows[0], for example SMA(Lows[1])[0], would be passing the low series of the secondary series added to a script
            .
            I have provided a sample script which will print the highs and lows of the 1st, 2nd, and third series added to the script.

            You could also see under Multi-Time Frame ISeries,


            Please let us know if you need further assistance.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ZenCortexCLICK, Today, 04:58 AM
            0 responses
            5 views
            0 likes
            Last Post ZenCortexCLICK  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            172 responses
            2,281 views
            0 likes
            Last Post sidlercom80  
            Started by Irukandji, Yesterday, 02:53 AM
            2 responses
            18 views
            0 likes
            Last Post Irukandji  
            Started by adeelshahzad, Today, 03:54 AM
            0 responses
            8 views
            0 likes
            Last Post adeelshahzad  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X