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

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.


    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.

        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 = [COLOR=red][B]8[/B][/COLOR]; // Default setting for StartHour
                                private int startMinute = 00; // Default setting for StartMinute
                                private int endHour = [COLOR=red][B]9[/B][/COLOR]; // 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:
                        [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]
                        if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (startDateTime.Date != Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Date)
                        {
                        startDateTime = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] DateTime(Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Year, Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Month, Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Day, StartHour, StartMinute, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);
                        endDateTime = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] DateTime(Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Year, Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Month, Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Day, EndHour, EndMinute, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);
                        }
                        [/SIZE][/FONT][/SIZE][/FONT]
                        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.
                        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 Barry Milan, Yesterday, 10:35 PM
                          5 responses
                          16 views
                          0 likes
                          Last Post NinjaTrader_Manfred  
                          Started by DanielSanMartin, Yesterday, 02:37 PM
                          2 responses
                          13 views
                          0 likes
                          Last Post DanielSanMartin  
                          Started by DJ888, 04-16-2024, 06:09 PM
                          4 responses
                          13 views
                          0 likes
                          Last Post DJ888
                          by DJ888
                           
                          Started by terofs, Today, 04:18 PM
                          0 responses
                          12 views
                          0 likes
                          Last Post terofs
                          by terofs
                           
                          Started by nandhumca, Today, 03:41 PM
                          0 responses
                          8 views
                          0 likes
                          Last Post nandhumca  
                          Working...
                          X