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

Daily high close for

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

    Daily high close for

    Hello,

    Quick questions:
    1. In Strategy Wizard is there a way How can I check to see if a given bar's close is the highest (or lowest) close of the day so far?
    2. Also, can I use strategy wizard to put a 'timer' in a strategy. For example after the logic generates a trade I would want the strategy to wait for say 5 or ten minutes before it starts looking for next triggering event.
    Any help is appreciated.

    Thanks much!

    #2
    1. In the Condition Builder, expand the indicators. You will find one called CurrentDayOHL. Select this then in the Plot parameter select CurrentHigh. On the right hand side then select Price -> High. If they are equal to each other than you know the current bar's high is also the current day's high.

    2. If you are running on one minute bars, then you can expand the Misc section and select "Bars since entry". Then on the right hand side select "Numeric value" from Misc and then type in 5 or 10.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh...this allows me to look at OHL but not close for a given bar. Is there a way with this (or another) function to look at the bar close as opposed to open, high, low?

      Comment


        #4
        Not sure what you are after. You never know the close of the day until the close happens. You can't check 9AM's bar against the day's close. You do not know this information till 4PM. As far as the 9AM's bar is concerned the close of the day is the same as the close of that bar.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          sorry Josh...Iwas not clear. I meant to only compare to the days high thus far. So say it is 3:30 PM then I would look at the bar close to see if the 3:30 PM bar close is the highest close - up to that point in the day. Maybe this is not possible to do directly.

          Comment


            #6
            kjohnson67,

            Unfortunately you will have to custom code this with unlocked code. If you know you are always going to check this at 3:30PM and you know you are using 1min bars you can do it in the Strategy Wizard.

            Select the MAX indicator. Change the Input series to Close. In Period, type in how many bars you want to check back. This should be equal to however many 1min bars have passed to reach 3:30PM from the session open. Then you can compare that to the close price on the right.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              The formula posted sounded like what I needed. I want to go long if the stock hits the High for the day in the last 90 min. For some reason the attached strategy is just buying at 2:30 PM each day. Please tell me what I did wrong. 15 min bars btw & exit on close. Thanks.
              Attached Files

              Comment


                #8
                bkout,

                Your strategy will place a trade when time is greater than 2:30PM and your current high is greater than or equal to the current day's high. Please check the charts to visually confirm.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Yes that's pretty much what I want to do but unfortunately as you can see by the attached chart the strategy is buying every day after the 2:30 bar and ignoring the other rule -- must be something off. BTW if possible I'd prefer that the rule was that the stock makes a new high for the day rather than possible just match an earlier high -- is that possible?
                  Attached Files

                  Comment


                    #10
                    Hmm. Please try running a new instance of this if you have made any changes to your strategy. It should work as you have outlined.

                    As far as forming new highs you may need to self code to do that. There are several reference samples here that show you techniques that you may need to mix and match to get the desired effect: http://www.ninjatrader-support2.com/...ead.php?t=8600
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Josh, I deleted my strategy, repaired the database, shut down Ninja and re-opened it and created the Strategy from scratch without cutting and pasting. I get the same results -- every day the strategy buys after the 2:30 bar. Somehow I think the other rule is reading as a condition that is always true. Please look again at my snapshot below -- am I comparing the high of the current 15 min bar with the high of the day? Does something have to be 1 bar back or offset or something?? If and only if the condition is true then strategy should enter at open of next bar. Thanks. In case it helps here is part of the code:
                      #region Variables
                      // Wizard generated variables
                      privateint myInput0 = 1; // Default setting for MyInput0
                      // User defined variables (add any user defined variables below)
                      #endregion
                      ///<summary>
                      /// This method is used to configure the strategy and is called once before any strategy method is called.
                      ///</summary>
                      protectedoverridevoid Initialize()
                      {
                      CalculateOnBarClose =
                      true;
                      }
                      ///<summary>
                      /// Called on each bar update event (incoming tick)
                      ///</summary>
                      protectedoverridevoid OnBarUpdate()
                      {
                      // Condition set 1
                      if (CurrentDayOHL().CurrentHigh[0] >= High[0]
                      && ToTime(Time[
                      0]) >= ToTime(14, 30, 0))
                      {
                      EnterLong(DefaultQuantity,
                      "");
                      }
                      }
                      Last edited by bkout; 05-29-2009, 04:34 PM.

                      Comment


                        #12
                        Hello,

                        I will have Josh reply on Monday. Thank you for your patience.
                        DenNinjaTrader Customer Service

                        Comment


                          #13
                          I'm not sure I follow bkout - it works as expected in backtesting, the trade is of course placed on the next 15 min bar after your condition evaluated to true. If you need to test this with intra 15 min bar executions you would need to work the code of this sample in - http://www.ninjatrader-support2.com/...ead.php?t=6652

                          Have you tried running this on a 1 min chart for example? This will also get your closer to the breakout point you seek to catch.
                          BertrandNinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Rapine Heihei, 04-23-2024, 07:51 PM
                          2 responses
                          30 views
                          0 likes
                          Last Post Max238
                          by Max238
                           
                          Started by Shansen, 08-30-2019, 10:18 PM
                          24 responses
                          943 views
                          0 likes
                          Last Post spwizard  
                          Started by Max238, Today, 01:28 AM
                          0 responses
                          9 views
                          0 likes
                          Last Post Max238
                          by Max238
                           
                          Started by rocketman7, Today, 01:00 AM
                          0 responses
                          5 views
                          0 likes
                          Last Post rocketman7  
                          Started by wzgy0920, 04-20-2024, 06:09 PM
                          2 responses
                          28 views
                          0 likes
                          Last Post wzgy0920  
                          Working...
                          X