Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple indicator on second symbol

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

    #16
    Yeah it works now! Thanks so much for this help. This was a great tutorial for me as well. I'm a bit newer to Ninja Script and I understand now how this is working.

    Comment


      #17
      Originally posted by Baseheadz View Post
      Yeah it works now! Thanks so much for this help. This was a great tutorial for me as well. I'm a bit newer to Ninja Script and I understand now how this is working.
      Happy to hear we got it working for you - have a great Sunday.

      Comment


        #18
        Originally posted by Baseheadz View Post
        Yeah it works now! Thanks so much for this help. This was a great tutorial for me as well. I'm a bit newer to Ninja Script and I understand now how this is working.
        Happy to hear we got it working for you - have a great Sunday.

        Comment


          #19
          Again thank you for everything thus far. I have another question regarding this type of indicator where we are looking at the volume of an added symbol.

          In the current example if I have a new chart with a 1 minute ES 06-11 and OneSecondVolume is retrieving the 1 second volume information on the NQ 06-11 and I use the strategy wizard:

          CrossAbove(OneSecondVolume().Plot0, VolumeFilter,3)

          Does this statement refer to the last 3 bar lookback period of the1 minute bars on the ES or the 1 second bars on the OneSecondVolume indicator?

          Comment


            #20
            It should refer to the 1 second volume in the indicator, as this would be used for Plot0 in it.

            Comment


              #21
              Is there any way to make this refer to the 3 bar lookback on the 1 minute ES chart?
              Could I do this in the strategy wizard or do I have to code it by hand?

              Comment


                #22
                Working with multiple series would not be supported in the wizard and would normally require custom coding, however I think you can try going with a lookback of 180 here, this should approximate 3 x 1 minute bars then.

                Comment


                  #23
                  I'm trying to plot the spread of the Ask - Bid from the second symbol.

                  I changed the add to this:
                  Add("NQ 06-11",PeriodType.Second, 1, MarketDataType.Ask);
                  Add("NQ 06-11",PeriodType.Second, 1, MarketDataType.Bid);

                  I then changed the plot to this:
                  Plot0.Set((Close[1][0]) - (Close[2][0]));

                  When I compile it says "Cannot apply indexing with [] to an expression of type 'double'"

                  How can I fix this error?

                  Thanks!

                  Comment


                    #24
                    You would need to work with Closes here to access the 2nd and 3rd series' closing value.

                    Comment


                      #25
                      Yes, Closes did work! Thanks.

                      I've read the documentation for how the how the bars are referenced. If I create a new 1 minute ES chart , and I use the one second Ask-Bid indicator on the NQ, I notice that the indicator plots the 1-second bar for the NQ at the close of the 1-minute ES bar.

                      1) Is it possible to have the indicator plot the highest value that occurred during that 1-minute ES bar? How about plotting the highest value of the 1-second indicator that occurred during a 1000 volume bar on the ES?

                      2) Also, if I were to use the 1-second indicator in a strategy, would the strategy look at the intrabar calculations on the 1-minute ES bars to reference the 1-second indicator? In other words, does all of the 1-second indicator information become obsolete in a strategy that trades on the 1-minute ES chart? What you see on the chart is what you get in the strategy?

                      Thanks so much for all of your input thus far!

                      Comment


                        #26
                        Data availability varies based on whether you're accessing historical or real time with COBC = false. This is detailed in the link below in the section: How Bar Data is Referenced


                        I suggest playing around with it in historical and real time to see how it works. Printing time stamps for all series is helpful in seeing how they relate to one another.

                        The strategy can look at all potential series and it all depends on how you have coded it. OnBarupdate() is called for all series unless you filter with a specific BarsInProgress. Series don't become obsolete only because you added a smaller one.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #27
                          Thanks for the reply. I read through all of the bar referencing info a few times.

                          Let's assume that I'm using this 1-second NQ Ask-Bid indicator. I am using OnBarUpdate() in the 1-second Ask-Bid indicator.

                          If I'm using the 1-second Ask-Bid indicator in the strategy wizard as a "filter" in the strategy, how do I make sure that the strategy is looking at the data 1-second indicator?

                          Comment


                            #28
                            You filter using a specific BarsInProgress.


                            if (BarsInProgress == 1)
                            {
                            //Only updates for 1st added series here.
                            }
                            Ryan M.NinjaTrader Customer Service

                            Comment


                              #29
                              Thanks Ryan. I have been going through my data with a fine tooth comb and it appears as though it is working without having to place any filters that use (BarsInProgress == 1).

                              Comment


                                #30
                                Originally posted by NinjaTrader_Bertrand View Post
                                Please try using this OnBarUpdate() instead below and reapply the indicator then to your chart - would it work then?

                                protected override void OnBarUpdate()
                                {
                                if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return;


                                Plot0.Set(Volumes[1][0]);
                                }

                                I tried using this and sometimes I get the error:
                                "Error on calling 'OnBarUpdate' method for indicator "OneSecondVolume": You are accessing an index with a value that is invalid since it is out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4bars on the chart."

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                579 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                334 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                101 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                554 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                551 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X