Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Volume for the day

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

    Volume for the day

    Hi,

    How would I go about getting the volume for the day session say since the open for use in NinjaScript?

    suprsnipes

    #2
    Hello Suprsnipes,

    Thank you for your post.

    This is much easier to do with Multiseries. You would add a daily interval to your strategy and then access the volume of this seconday series with Volumes.
    http://www.ninjatrader-support.com/H...6/Volumes.html

    You can plot multiseries from a strategy in 6.5 but you'll have to wait until version 7 for full support of multseries in an indicator.

    This sample below tells how to plot from within a strategy.
    Plotting from within a NinjaScript strategy.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      I have reviewed the suggested links but I would like to ask you how do I use the bars ago method to total volume from a specific time value?

      Or, the other idea I had was to use the CurrentDayOHL indicator provided by NT as a reference instead of using time, my coding experience is limited but I'm having a crack.

      Appreciate the feedback.

      Comment


        #4
        Hi suprsnipes,

        You can probably do this using a combination of ideas illustrated in this reference sample:
        Indicator: Calculating the highest high or lowest low for a specified time range

        Instead of MAX or MIN, use the SUM method.

        http://www.ninjatrader-support.com/HelpGuideV6/SUM.html
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I have downloaded the suggested sampleGetHighLowbyTimeRange but for some reason after entering the start / finish hour and minutes into the parameters the high and low plots are not working.

          Thanks in advance,
          suprsnipes
          Last edited by suprsnipes; 02-24-2010, 06:54 PM.

          Comment


            #6
            Hi Suprsnipes,

            Please post the code you're working with.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              The code I am working with is as per the sample
              "SampleGetHighLowByTimeRange.zip"

              I haven't changed anything...just wanted to see it working first, it appears as though it isn't. Perhaps I am doing something wrong?

              Comment


                #8
                Hello Suprsnipes,

                Documentation for this reference sample is contained within the code, in the comments.

                How is it not working for you?

                Some details that may help us identify the specific problem:
                1) Who is your data provider?
                2) What instrument are you charting?
                3) What bar interval?
                4) What parameters have you used for time settings?
                5) What values do you expect? What values are you getting instead?
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Ryan,

                  Thanks for the reply.

                  1) Who is your data provider? Interactive Brokers
                  2) What instrument are you charting? 6A
                  3) What bar interval? 10min
                  4) What parameters have you used for time settings? AEST (Australian Eastern Standard Time)
                  Code:
                  #region Variables
                          // Wizard generated variables
                              private int startHour = 9; // Default setting for StartHour
                              private int startMinute = 00; // Default setting for StartMinute
                              private int endHour = 8; // Default setting for EndHour
                              private int endMinute = 00; // Default setting for EndMinute
                  5) What values do you expect? I would just like to get the lowestLow and highestHigh as per the existing strategy. What values are you getting instead? Nil

                  Comment


                    #10
                    Your end hour is before your start hour. If you want the range from 8 to 9, try switching these around.


                    Code:
                     
                    #region Variables
                            // Wizard generated variables
                                private int startHour = 8; // Default setting for StartHour
                                private int startMinute = 00; // Default setting for StartMinute
                                private int endHour = 9; // Default setting for EndHour
                                private int endMinute = 00; // Default setting for EndMinute
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Appreciate the help Ryan,

                      That did the trick.

                      I thought it was possible to run the indicator from one day to the next? How would you suggest I achieve that?

                      Comment


                        #12
                        This sample is meant for intraday highs and lows. To go across days requires a little modification to the StartDateTime and EndDateTime.

                        The block of code below is what defines your start and end times.

                        Code:
                        
                        if (startDateTime.Date != Time[0].Date)
                        {
                        startDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, StartHour, StartMinute, 0);
                        endDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, EndHour, EndMinute, 0);
                        }
                        
                        You can hard-code a specific date or work with the AddDays C# methods. You subtract days using negative values with this method.

                        AddDays(-1)


                        The reference sample below can help with working with GetBar():
                        Getting Indicator values from a specified time.

                        This one can help with manipulating DateTime objects.
                        http://www.ninjatrader-support2.com/...ad.php?t=19292
                        Last edited by NinjaTrader_RyanM1; 03-19-2010, 11:34 AM. Reason: changed approach to be closer to existing reference sample
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          Thanks again Ryan

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by larkmail, Today, 12:30 PM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_Kate  
                          Started by omermirza, Today, 12:39 PM
                          0 responses
                          6 views
                          0 likes
                          Last Post omermirza  
                          Started by Danila, Today, 11:08 AM
                          1 response
                          11 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by dbida001, Today, 10:31 AM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_ChristopherJ  
                          Started by Brandon9821, Today, 08:27 AM
                          3 responses
                          30 views
                          0 likes
                          Last Post Brandon9821  
                          Working...
                          X