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

Opening Range Breakout

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

    Opening Range Breakout

    Good afternoon,

    I'm new to the Ninjatrader forums. I am trying to build an opening range breakout strategy, I was wondering if anybody could point me in the right direction of some material for a complete beginner to have a look over?

    Anything that could give me a first insight to programming with Ninjatrader?

    Thanks in advance.

    #2
    Hello 2595_MNS,

    Thanks for your post and welcome to the NinjaTrader forums.

    You can create a strategy with the strategy builder which is a non-programming interface or you can code directly in the ninjascript editor which is based on C# programming language where we have provided many methods and properties to assist. You can also start with the strategy builder and then unlock its code to then work directly in ninjascript.



    If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started. You will find language references to all of the methods and functions you will be using.

    NT8: http://ninjatrader.com/support/helpG..._resources.htm

    This video introducing the NinjaScript editor is an excellent resource,

    Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.3:11 Creating a New NinjaScript Strategy13:52 Analyz...


    You will find reference samples online as well as some tips and tricks for both indicators and strategies:




    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

    There is also a growing library of user submitted custom indicators (100+) and strategies that can be downloaded from our support form. Please look in the NinjaScript file sharing section of our support forum as you may find what you are looking for there:



    Finally, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you, I have one more question. I am using the Strategy Builder, is there a way of addming more than one condition? I don't know if I am explaining this properly but I will give it a try...

      I want to enter a short position if the Ask crosses below the low of the first bar of the sessions low. Is this possible? If so how would I go about doing it? Everything I am trying at the moment it just tells me 'Type of left expression and right expression do not match.'

      Thanks in advance

      Comment


        #4
        Hello 2595_MNS,

        Thanks for your reply.

        Please post a screenshot of the strategy builder window that is providing the error.

        If you prefer not to post, please feel free to send into PlatformSupport[at]NinjaTrader[dot] com, mark the e-mail atten: Paul and provide a link to this thread for reference.
        Paul H.NinjaTrader Customer Service

        Comment


          #5



          web hosting png

          Sorry if I am being stupid here but like I said I am very new to Ninjatrader. I feel like I need an extra condition so I can tell the strategy that 'Ask > cross below > First bar of session Low to do the following. But I can't work out how to tell it I need price to cross the low of the first bar of the session.


          Thanks again

          Comment


            #6
            Hello 2595_MNS,

            Thanks for your reply.

            The error is because you are trying to compare a value (CurrentAsk) to a boolean variable. FirstBarOfSession would be true only on the first bar of the session.

            If I understand correctly you want to enter an order if after the first bar of the session price goes below the low of the first bar of the session. In that case you would want the first set to have the condition to check if the first bar of the session == true and then the action would be to save the low of that bar into a variable (that you create, maybe called FirstBarLow).

            In the 2nd set you can then have the condition if the Close (or low) of the current bar crosses below the level of variable FirstBarLow. The action would then be to enter an order.

            I've created a short video walk through of how to do this in the strategy builder: https://Paul-ninjaTrader.tinytake.co...IxNF81NzI1NjQ5
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thank you! This has got me started at least, I will do my best to work out how to add stops and targets myself. Thanks for your help

              Comment


                #8
                Hello Paul,

                Unfortunately I don't think this is what I was after.

                Would this be the correct way to begin to do the following?

                After close of the first bar of the session, place a buy stop at the high of the first candle, and a sell stop at the low of the first candle. Stop loss for the buy stop will be at the low of the candle, and stop loss for the sell stop will be at the high of the first candle. If one trade is filled, cancel the other order.
                Exit at the end of the session.

                Any help would be greatly appreciated.

                Comment


                  #9
                  Hello 2595_MNS,

                  Thanks for your reply.

                  You would not be able to place orders to enter at either end of the same bar as this would violate the managed approach internal rules, please see the section, "Internal Order Handling Rules that Reduce Unwanted Positions": http://ninjatrader.com/support/helpG...d_approach.htm

                  What you can do is in set 1, save the first bar of the sessions High and Low value into two variables and then have one set observe if price is below the low and then would enter short order and another set that enters long if it is above the high. If you only want to enter one way or the other, you would need to add a couple of bool variables that would be set when one or the other side enters its order which can be used to prevent entry in the other direction.

                  As far as stop loss and profit target, you can start with using the SetStopLoss and SetProfitTarget as these are OCO tied. However they cannot be set dynamically in the strategy builder meaning you would have to set them to fixed points. For this then we recommend using the CalculationMode.Ticks and then setting the values as you need them. The Set methods will work regardless of the direction (long or short). For example, if you set the stop-loss at 10 ticks and the profit target at 20 ticks, when the strategy enters a short position, the stop would be placed 10 ticks above the entry and the profit target would be 20 ticks below the entry. When the strategy enters long, the stoploss will be 10 ticks below the entry and the profit target 20 ticks above.

                  To create an opening range breakout strategy in the manner you have decribed, you would need to code directly in Ninjascript and use the unmanaged approach, however the unmanaged approach does not use the protective controls of the managed approach and the coder is responsible for all error handling.

                  An alternative is always to hire a programmer to create the strategy you wish and if this is of interest we can provide you with references to 3rd party providers of that service.
                  Paul H.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Barry Milan, Today, 10:35 PM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by WeyldFalcon, 12-10-2020, 06:48 PM
                  14 responses
                  1,427 views
                  0 likes
                  Last Post Handclap0241  
                  Started by DJ888, Yesterday, 06:09 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  40 views
                  0 likes
                  Last Post jeronymite  
                  Started by bill2023, Today, 08:51 AM
                  2 responses
                  16 views
                  0 likes
                  Last Post bill2023  
                  Working...
                  X