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
    }
    http://www.ninjatrader.com/support/h...rofsession.htm
    http://www.ninjatrader.com/support/h...ttickofbar.htm
    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
        }
        http://www.ninjatrader.com/support/h...r_day_ohlc.htm
        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 rustyspring, Today, 10:55 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Started by collic653, Today, 10:05 AM
                3 responses
                19 views
                0 likes
                Last Post collic653  
                Started by ErikY, Today, 10:09 AM
                5 responses
                19 views
                0 likes
                Last Post s.kinra
                by s.kinra
                 
                Started by soulfx, Today, 08:08 AM
                6 responses
                19 views
                0 likes
                Last Post soulfx
                by soulfx
                 
                Started by datahogg, Today, 08:05 AM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_BrendanC  
                Working...
                X