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

DrawRectangle and time

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

    DrawRectangle and time

    Evening,

    Looking to build a drawrectangle procedure that draws a box around the high and low of the period between 11:00am and 6:00pm.

    We have two problems

    1. How do we get the high and low over a particular time period ?
    2. How can we pass this into a drawrectangle command ?

    Any help would be appreciated.

    I should also add that my session starts at 11:00am. Been playing with firstbarofsession

    Cheers
    Last edited by Virge666; 03-02-2009, 04:59 AM.

    #2
    Welcome to the NinjaTrader support forums Virge666!

    You can check out this reference sample for your request - http://www.ninjatrader-support2.com/...ead.php?t=8600

    The DrawRectangle method allows you to input the respective x/y start/end values - http://www.ninjatrader-support.com/H...Rectangle.html

    If you need historical draw objects, use a unique tag id like "myTag" + CurrentBar
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Welcome to the NinjaTrader support forums Virge666!

      You can check out this reference sample for your request - http://www.ninjatrader-support2.com/...ead.php?t=8600

      The DrawRectangle method allows you to input the respective x/y start/end values - http://www.ninjatrader-support.com/H...Rectangle.html

      If you need historical draw objects, use a unique tag id like "myTag" + CurrentBar

      thankyou.

      I have been playing with the sample quite extensively. And the plan was to just modify this to give me my indicator.

      The problem is how do we draw a box around the highs and lows of a particular day range... we can use 10 bars back, but I cannot use from 11am to 6pm for example.

      Any ideas would be very useful... I just cannot find a way to find the highest value in a range of a few hours when the current time may be 5pm or it may be 10pm...

      Cheers

      Comment


        #4
        You could either use the indicator the way it is and input your custom start and end times for the range to be defined.

        As those keep developing throughout the day, you would need to save the highest / lowest values into variables and you those then in your DrawRectangle call, if you use a non-unique tag ID the rectangle will be redrawn as new values are established.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          First hour High & Low

          Hi Support,

          I was just trying to find indicator to plot for 1st hour High & Low values. I came across SampleSessionHighLow indicator as per the discussion here in this part of the support forum to have this requirement met. I loaded the indicator on chart but faced the following problem.

          I trade from Australia and hence for me the US Future Market start trading at 00:30 AM and therefore my inputs for the Sample indicator would be

          OpenHour = 0
          OpenMinute = 30
          EndHour = 1
          EndMinute = 30

          Now, first of all this indicator does not accept '0' value as the input for OpenHour and the moment I load the indicator on the chart with these values, the value of '0' changes to '1' on its own, clearly showing that '0' value is not acceptable or this indicator is not written for such value. This means I get High & Low values formed from 01:30 AM till 01:30 AM that serves no purpose for me. I believe that the indicator must be working fine where inputs for Open and Close Hours are less than 12 (maybe 12 hour format) but it does not take values in 24 hour format probably and therefore unfortunately cannot be used by users of Ninja Trader not staying in a time zone where the market opens during daytime. I feel stucked with this requirement and would appreciate support assistance.

          Best regards,
          Yusuf SHAIKH

          Comment


            #6
            Yusuf,

            The indicator you are referring to is just a technical reference sample and was never intended for actual use. It demonstrates key concepts of how to program such a condition.

            As far as making this work for you it only requires very small tweaks that you can do yourself. Please open up the indicator in the NinjaScript Editor and expand the Properties region of the code.

            You will see this:
            Code:
            [Description("")]
            [Category("Parameters")]
            public int StartHour
            {
                get { return startHour; }
                set { startHour = Math.Max([B][COLOR=Red]1[/COLOR][/B], value); }
            }
            
            [Description("")]
            [Category("Parameters")]
            public int StartMinute
            {
                get { return startMinute; }
                set { startMinute = Math.Max([COLOR=Red][B]1[/B][/COLOR], value); }
            }
            
            [Description("")]
            [Category("Parameters")]
            public int EndHour
            {
                get { return endHour; }
                set { endHour = Math.Max([COLOR=Red][B]1[/B][/COLOR], value); }
            }
            
            [Description("")]
            [Category("Parameters")]
            public int EndMinute
            {
                get { return endMinute; }
                set { endMinute = Math.Max([COLOR=Red][B]1[/B][/COLOR], value); }
            }
            On each of the lines that start with "set", change Math.Max(1, value) to Math.Max(0, value).

            So it should look like this:
            Code:
            [Description("")]
            [Category("Parameters")]
            public int EndMinute
            {
                get { return endMinute; }
                set { endMinute = Math.Max([COLOR=Red][B]0[/B][/COLOR], value); }
            }
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh...

              Hi Josh,

              Thanks for your expert comments as usual. The formula did work for me and I am satisfied with the results. Atleast I don't have to manually feed the values now and it is system picked. Thanks once again and good day.

              Best regards,
              Yusuf SHAIKH

              Comment


                #8
                Originally posted by fy260498 View Post
                Hi Josh,

                Thanks for your expert comments as usual. The formula did work for me and I am satisfied with the results. Atleast I don't have to manually feed the values now and it is system picked. Thanks once again and good day.

                Best regards,
                Yusuf SHAIKH

                me too mate - Thankyou.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by techgetgame, Yesterday, 11:42 PM
                0 responses
                8 views
                0 likes
                Last Post techgetgame  
                Started by sephichapdson, Yesterday, 11:36 PM
                0 responses
                2 views
                0 likes
                Last Post sephichapdson  
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,613 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Yesterday, 05:56 PM
                0 responses
                10 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                20 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Working...
                X