Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Break HOD go long

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

    Break HOD go long

    ok...I am a noob but I think I should be able to figure this out. I am trying to do something very simple but can't get it to work right. I am using the strategy wizard and trying to simply put on a long position when price touches 1 tick past the high of the current day. I have wasted way too much time on this as I just know it is very simple. Any help would be appreciated.

    #2
    Welcome to our forums - what issues have you run into? If your entry triggers, the trade would be executed on the next bar in backtesting.

    Comment


      #3
      I suppose since I am new at this I am using flawed logic. Here is what I have come up with and a pic of what I get:

      // This namespace holds all strategies and is required. Do not change it.
      namespace NinjaTrader.Strategy
      {
      /// <summary>
      /// Enter the description of your strategy here
      /// </summary>
      [Description("Enter the description of your strategy here")]
      public class HiLowBreak : Strategy
      {
      #region Variables
      // Wizard generated variables
      private int target = 1; // Default setting for Target
      private int stop = 1; // Default setting for Stop
      // 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>
      protected override void Initialize()
      {
      Add(CurrentDayOHL());
      SetProfitTarget("", CalculationMode.Ticks, Target);
      SetStopLoss("", CalculationMode.Ticks, Stop, false);

      CalculateOnBarClose = true;
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      // Condition set 1
      if (GetCurrentBid() > CurrentDayOHL().CurrentHigh[1] + 1 * TickSize)
      {
      EnterLong(DefaultQuantity, "");
      }

      }

      #region Properties
      [Description("")]
      [GridCategory("Parameters")]
      public int Target
      {
      get { return target; }
      set { target = Math.Max(0, value); }
      }

      [Description("")]
      [GridCategory("Parameters")]
      public int Stop
      {
      get { return stop; }
      set { stop = Math.Max(0, value); }
      }
      #endregion
      }

      Comment


        #4
        Looks good to me, but unfortunately I did not see the pic with the outcome....also: GetCurrentBid uses the Close value in backtesting, so this might be different from what you expect.

        Comment


          #5
          World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.

          Comment


            #6
            Correct this setup will trigger continously if a new HOD is made - are you looking to enter only once per day?

            Comment


              #7
              No...each time HOD is exceeded by 1 tick unless, of course, it is already actively in a trade.

              Comment


                #8
                I suggest you add a drawing to your strategy so you can visually see when exactly it would trigger to place a trade on the next bar - http://www.ninjatrader-support.com/H...gOnAChart.html

                Comment


                  #9
                  ok I will try that, but I actually want it to place the trade on the current bar...on touch one tick beyond HOD

                  Comment


                    #10
                    Then you need to work with CalculateOnBarClose = false in realtime to be able to update the calcs on each tick - http://www.ninjatrader-support.com/H...BarClose1.html

                    Comment


                      #11
                      well...you must love working with noobs....I can't get a drawing object to print in my strategy. Nothing shows up on the chart. ideas?

                      Comment


                        #12
                        What y axis value did you choose to draw the object at? Most leave it a first at 0, so this will then never show up unfortunately.

                        Comment


                          #13
                          I've tried 0, 1, -1. I can get a bar color to change or outline color to change...cant get dot, triangle, arrow, etc. to print

                          Comment


                            #14
                            Please follow the example here very closely - http://www.ninjatrader-support.com/H...gOnAChart.html

                            0, 1, -1 would not make sense, to draw you would want to use a valid value on your Y Price axis, such as the High / Low with an offset.

                            Comment


                              #15
                              oops...yeah that got it, thanks.

                              Comment

                              Latest Posts

                              Collapse

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