Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to buy at the opening price at the instance of a new bar

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

    How to buy at the opening price at the instance of a new bar

    Hi team,

    I'm a newbie to NT8 and currently in the simulated platform.

    Would you please guide me on how i can place long/short orders at opening price instantly when a new bar forms?

    Currently i use the buy/sell limit by pointing to the new bar's opening price>right click>buy/sell limit.

    Eg: Say the green bar closes and (new)red bar forms. I would like to immediately short (sell limit) at it's opening price (11 451.5).
    My current ATM strategy is to stop loss= 24, profit= 8. (ticks)

    Click image for larger version  Name:	1.PNG Views:	0 Size:	5.8 KB ID:	1118368

    Currently, most of the time I'll miss the window for my strategy as it takes time to execute this.

    If you would be so kind to point out what options i have and how can I go about it?

    P.S : I'm new to scripting as well, so any baby steps would be greatly appreciated.

    Thank you.


    #2
    Hello Roy8888, thanks for your post.

    NinjaScript strategies can do a lot of things. Strategies can control every aspect of trading in the platform, so it's best to first understand how they work and what you want out of the strategy. Please first read through this post from our colleague Chelsea:

    https://ninjatrader.com/support/foru...sample-scripts

    A good place to start is the Strategy Builder. It can generate code for you and when you are ready to dive into how the script works on a code level, you can unlock the code. We have a few examples here in the Strategy Builder documentation:
    https://ninjatrader.com/support/help...on_builder.htm

    Protective Stop and Target orders can also be set from the "Stops and Targets" tab of the builder.

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,

      Thank you for the prompt reply. Just to give an idea on what I'm trying to do :

      Eg: I'm monitoring using a box bar & a chart.

      Whenever the charts shows a cross, and a (new)bar (red/green) forms :

      Click image for larger version  Name:	2.PNG Views:	0 Size:	2.4 KB ID:	1118428

      Click image for larger version  Name:	1.PNG Views:	0 Size:	5.8 KB ID:	1118427
      I would like to immediately short (sell limit) at the red bar's opening price (11 451.5).
      My current ATM strategy is to stop loss= 24, profit= 8 (ticks)

      The same applies for long scenarios.

      If possible would you mind sharing an working example on the above using the Strategy Builder (esp Conditions and Actions)?
      Any would do, as i can move on from there.

      Thank you!
      Last edited by Roy8888; 09-15-2020, 11:25 PM.

      Comment


        #4
        Hello Roy8888, thanks for your reply.

        We have existing examples of setting up a cross condition. The one linked here from the Strategy Builder tutorial is a CrossAbove condition for two EMAs of period 9 and 20, you would want to check for a CrossBelow for a short order.

        https://ninjatrader.com/support/help...sOverCondition

        To submit a sell order at the open (we are assuming the open price is greater than the closing price), select "Submit short position by a limit order" from the Actions.

        Best regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hi Chris,

          Thank you so much for this. I shall look into it and give it a try and get back to you.

          Cheers!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jjygwbejjhf, Today, 07:46 AM
          0 responses
          1 view
          0 likes
          Last Post jjygwbejjhf  
          Started by localappleseed, Yesterday, 08:16 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by aslane, Today, 06:57 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by MisterGee, Yesterday, 09:27 PM
          2 responses
          18 views
          0 likes
          Last Post MisterGee  
          Started by soyjesus, Today, 05:27 AM
          0 responses
          5 views
          0 likes
          Last Post soyjesus  
          Working...
          X