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

Breakout at certain time.

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

    Breakout at certain time.

    Is it possible in Strategy Builder to place pending orders on either side of a particular bar if price breaks either?

    Also can specific time bars be coded? Example Bar that ended at 0900 hours etc.

    Thanks.

    #2
    Hello Trader17,

    Thanks for opening the thread.

    Is it possible in Strategy Builder to place pending orders on either side of a particular bar if price breaks either?
    While it is possible to create a strategy in the Strategy Builder that can place orders above and below the market based off of your own logic, it would not be possible to place two entry orders that are paired with OCO so that one entry order cancels the other.

    For example, using the Managed Approach (in the Strategy Builder) you can only specify an Entry Signal that ties the entry to the automatically OCO'd exit orders created with SetProfitTarget() and SetStopLoss().

    This kind of strategy would have to be programmed using the Unmanaged Approach. This approach is reserved for experienced programmers who are willing to take on the responsibility of managing their orders and writing the correct syntax on their own.

    Also can specific time bars be coded? Example Bar that ended at 0900 hours etc.
    Bar closes will occur as often as you specify for the data series you are using. This would mean that if you had a 5 minute data series, you would get bar closes every 5 minutes. If you had a 60 minute series you would get closes for every hour.

    Many clients use an additional data series to perform certain actions that occur on a different period of time than the primary data series. For example, you could add a 60 minute data series and perform actions on the BarsInProgress for that data series. How to use BarsInProgress in a multi series NinjaScript is documented in our help guide. I will provide a link for your reference.

    I have created a video for how you can reference the time of a bar for the primary or secondary data series. As the print is not added to a condition for a specific BarsInProgress, the print will occur for an update on each bar added to the script. In the demonstration, there is the primary data series and the 60 minute secondary data series.

    Demonstration - https://www.screencast.com/t/5nuu3pd7Ye9V

    For more information on these concepts I suggest to review the documentation below:

    Unmanaged Approach - https://ninjatrader.com/support/help...d_approach.htm

    Multi Series NinjaScripts - https://ninjatrader.com/support/help...nstruments.htm

    For a complete understanding of all of the order methods available and how they are used, either through the Strategy Builder or by coding manually, I suggest to review the documentation for all order methods that you wish to use. They are documented here: https://ninjatrader.com/support/help...er_methods.htm

    Please let me know if you have any questions on the material.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks. I watched the video. Where do I enter the time of bar that closed I want referenced? Like say 0900 bar only on the 60 min. chart. Sorry am new to all this.
      Thanks.
      Last edited by Trader17; 07-12-2017, 01:53 PM.

      Comment


        #4
        Hello Trader17,

        As mentioned in the video, the Times object is referenced by a BarsInProgress index and a barsAgo index. These indexes will be used to reference the data series and the bar that you wish to reference. If you would like to reference a bar of certain time, you would have to get the barsAgo of that bar so it can be referenced by an index.

        If you would like to programmatically get the barsAgo for a certain time when the strategy is running, you can use the GetBar() method. This method must be programmed by hand and cannot be created in the Strategy Builder.

        For usage of GetBar(), you can refer to the help documentation below.

        GetBar() - https://ninjatrader.com/support/help...us/?getbar.htm

        If you are looking to have your strategy perform a certain action at a given time, you can create a condition using a TimeSeries to make sure that the current bar iterating is within the interval that you wish to check. Creating a condition based upon time is possible in the Strategy Builder without unlocking.

        We do not offer programming education in the support department at NinjaTrader. If you are looking for such resources, we do have some material in the Programming Concepts section of the NinjaTrader 7 help guide and the various Tips we have hosted on our forums.

        NT7 Programming Concepts - http://ninjatrader.com/support/helpG...g_concepts.htm

        Using [] brackets - http://ninjatrader.com/support/forum...ad.php?t=19346

        Other Tips - http://ninjatrader.com/support/forum...splay.php?f=31
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cls71, Today, 04:45 AM
        0 responses
        1 view
        0 likes
        Last Post cls71
        by cls71
         
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        213 views
        1 like
        Last Post PaulMohn  
        Started by TheWhiteDragon, 01-21-2019, 12:44 PM
        4 responses
        544 views
        0 likes
        Last Post PaulMohn  
        Started by GLFX005, Today, 03:23 AM
        0 responses
        3 views
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        12 views
        0 likes
        Last Post XXtrader  
        Working...
        X