Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy on the Open of the day.

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

    Buy on the Open of the day.

    I would like to buy or sell on the Open of the day.

    So, is it possibel to place an order on the open of a bar?

    Or is the only possibility to go on lower timeframes?

    #2
    Hello Ironman9973,
    Yes, you can place an order at the open of the day. Please use the below code to do it.
    Code:
    if (Bars.FirstBarOfSession && FirstTickOfBar)
    {
      //do something
    }

    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you. But I have one more question.

      I would like to buy on the open of today, only if the open of today is greater then the close of yesterday. A Gap.

      Is this possibel?

      Comment


        #4
        Hello Ironman9973,
        Yes, you can do so using the PriorDayOHLC indicator. You have to define a "gap" for it. For example if current open is 10 ticks above the prior days high then do something

        Code:
        if (Bars.FirstBarOfSession && FirstTickOfBar && Open[0] + 10 * TickSize > this.PriorDayOHLC().PriorClose[0])
        {
           //do something
        }
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          That does not work the way I like. I get my execution not on the open of the day.
          The execution is always on the open of the second bar of today.

          Comment


            #6
            Hello Ironman9973,
            To assist you further may I know what Calculate on bar close you are using while initializing the strategy.

            I look forward to assisting you further.
            Attached Files
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              I set the Calculate on bar close to false. But it is still not working
              Thanks.

              Comment


                #8
                Hello Ironman9973,
                To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

                Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

                I look forward to assisting you further.

                *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

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