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

Prining from multiseries chart

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

    Prining from multiseries chart

    Hi everyone

    I have a chart with two series:

    1) 30 second bars (primary), and

    2) 650 Renko bars

    In Initialize in a Strategy, I have this:

    Code:
    Add(PeriodType.Second, 30);
    AddRenko("^DJIA", 650, MarketDataType.Last);
    Then, in OnBarUpdate, I've put:

    Code:
    Print(Closes[0][0]);
    Print(Closes[1][0]);
    In the Output window, it appears to be printing new data for each tick - so there's a vast number of lines of data, most of it repeated.

    What I'd like, is an output giving data only for every 30-second bar with the corresponding Renko levels at those intervals.

    Much obliged in advance for any help with this.

    * If the 650 Renko looks big, it's because this is a ^DJIA chart - the Dow cash - and 650 in this is about 3 in the ES.)

    #2
    Hello,

    Thank you for your post.

    What is the period type and value the indicator or strategy is applied to? (ie. The Input Series)

    Comment


      #3
      Thanks very much for your reply, Patrick.

      To answer your questions, the series on the chart are exactly those ‘added’ in Initialize:

      Primary series: 30 seconds
      Secondary: 650 Renko.

      The sole object of this strategy is to print out the values of the two series, so I can take the data over to Excel and do an analysis.

      Since receiving your reply, I’ve changed round the series on the chart to make the Renko the primary series, and it now appears to work fine.

      So, is there a possible reason why the method didn’t seem to work well with the ‘seconds’ series as primary?

      Also, is it necessary to ‘add’ the primary series in Initialize, or should only the secondary series be ‘added’ there?

      Thanks in advance.

      Comment


        #4
        Hello arbuthnot,

        Thank you for your response.

        The Primary series is the instrument and period type you select when enabling the Strategy (either on the chart or the Strategies tab). Whichever series is added first in the code is the primary series and referencing Closes[0][0] actually references the primary series - being the chart or the Instrument selected on the Strategies tab.

        So if I want to reference the two series I would need the following (assuming I added the 30 second bar series first):
        Code:
        Print(Closes[1][0]); // prints the 30 second bar series close
        Print(Closes[2][0]); // prints the 650 renko bar close
        If you want to reference the primary series, it needs to be the instrument and period type the strategy is applied to and not added in the code.

        Comment


          #5
          Thanks once more, Patrick, that's very helpful.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Aviram Y, Today, 05:29 AM
          0 responses
          2 views
          0 likes
          Last Post Aviram Y  
          Started by quantismo, 04-17-2024, 05:13 PM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          7 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cls71, Today, 04:45 AM
          0 responses
          6 views
          0 likes
          Last Post cls71
          by cls71
           
          Started by mjairg, 07-20-2023, 11:57 PM
          3 responses
          217 views
          1 like
          Last Post PaulMohn  
          Working...
          X