• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 bboyle1234, Today, 01:06 AM
        0 responses
        3 views
        0 likes
        Last Post bboyle1234  
        Started by Sulfred, Today, 12:34 AM
        0 responses
        4 views
        0 likes
        Last Post Sulfred
        by Sulfred
         
        Started by U0000999, Today, 12:27 AM
        0 responses
        3 views
        0 likes
        Last Post U0000999  
        Started by radist, Today, 12:13 AM
        0 responses
        2 views
        0 likes
        Last Post radist
        by radist
         
        Started by mntemel, Yesterday, 10:25 PM
        0 responses
        3 views
        0 likes
        Last Post mntemel
        by mntemel
         
        Working...
        X