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 CarlTrading, 03-31-2026, 09:41 PM
                1 response
                152 views
                1 like
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                89 views
                1 like
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                131 views
                2 likes
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                127 views
                1 like
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                107 views
                0 likes
                Last Post CarlTrading  
                Working...
                X