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

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 bortz, 11-06-2023, 08:04 AM
                47 responses
                1,603 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                8 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                4 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                12 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X