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

Strategy that enters at a bar Close

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

    Strategy that enters at a bar Close

    Does any know of a Strategy that enters a trade on bar closure? Ideally this strategy would have a button to turn it on and off. This strategy would help me enter the trade without having to stare at a 10 min bar waiting for the next bar.

    Also, would like to know if one has been created or if something this this and could easily be modified.
    Last edited by Taddypole; 07-29-2021, 12:17 PM. Reason: Additional Thought

    #2
    Hello Taddypole,

    Thanks for your post.

    Strategies are designed to enter when entry signals are calculated and the strategy logic can be processed OnEachTick, OnPriceChange or OnBarClose.

    Enable tick boxes also come standard where the strategy can be enabled and disabled from the Strategies tab of the Control Center. Keep in mind, disabling a strategy will not close the position or cancel the strategy's protective orders. If you want to have protective orders cancelled when the strategy is disabled, you can check the Control Center's Tools > Options > Strategies > NinjaScript > "Cancel exit orders when a strategy is disabled" option.

    To set up a strategy where you enable it and it enters on the closure of the current bar, you can use the Strategy Builder and simply check if Misc > Current State equals Misc > State > Realtime and calls EnterLong()/EnterShort().

    Some resources on using the Strategy Builder can be found below.

    Strategy Builder 301 (publicly available resource) — https://www.youtube.com/watch?v=_KQF2Sv27oE

    Conditions examples —https://ninjatrader.com/support/help...on_builder.htm

    Actions examples — https://ninjatrader.com/support/help...us/actions.htm

    You could add buttons to a strategy that control bools that control when entry logic can take place, but for disabling the strategy, you will want to use the Enable tick box in the Control Center or Enable menu item from the strategies dialog. If you do want to add buttons from your strategy, an example that shows how you may add buttons is included below.



    The link above is publicly available.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


    Let us know if you have any questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      I guess what i'm looking for is not an automated system but a discretionary tool that allows me to decided on a bar that I would like to enter, and would automatically enter on the close of that bar and would apply an ATM that I could then manage.

      Is it possible to find that in the items you outlined above?

      Comment


        #4
        Hello Taddypole,

        Option #1: Use the Strategy Builder

        Enabling a strategy that checks if the state is realtime before submitting an order would be applicable to have an order placed upon the close of the current bar. You would just have to make sure the Calculate mode is set to OnBarClose, and enable the strategy, and the entry order will be fired on the close of that bar.

        Now this will not let you start an ATM strategy, but you could consider using the Stops and Targets page of the Strategy Builder or your own logic in Conditions and Actions (that checks if the Position is Long/Short) to control target and stop orders. This would be my recommendation if you do not want to get involved with unlocked code.

        Option #2: Start an Atm Strategy from an unlocked NinjaScript strategy

        That said, it is possible to start an Atm strategy from an unlocked NinjaScript strategy. If you set up the entry logic to enter, you can use this as your criteria to start an Atm strategy with CreateAtmStrategy(). This would be a more advanced approach that requires unlocking the code and being familiar with the Atm strategy methods.

        You can see our SampleAtmStrategy NinjaScript strategy which demonstrates how ATM strategies can be initiated and how various Atm strategy methods can be used.

        ATM strategies also must be initiated with realtime data and cannot be backtested in the Strategy Analyzer. You could use the Playback Connection to test these strategies against realtime data, however.

        Using ATM Strategies — https://ninjatrader.com/support/help...strategies.htm

        ATM Strategy Methods — https://ninjatrader.com/support/help...gy_methods.htm

        Playback — https://ninjatrader.com/support/help...connection.htm

        The above is what I would recommend if you wanted to get more involved with the strategy code.

        Option #3: Use AddOn code in an indicator to start an Atm Strategy

        It is also possible to build an indicator that adds buttons to the chart to start an ATM strategy on the close of the current bar using AddOn framework code. An example for adding buttons from an indicator can be found below. Account.CreateOrder and StartAtmStrategy would then be used to create the market order and submit it on a bar closure to start the ATM strategy.

        Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've


        Account.CreateOrder - https://ninjatrader.com/support/help...reateorder.htm

        StartAtmStrategy - https://ninjatrader.com/support/help...tmstrategy.htm

        The above is what I would recommend for an even more advanced approach.

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Great suggestions... I will look into those.... thank you

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GwFutures1988, Today, 02:48 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          6 responses
          32 views
          0 likes
          Last Post ScottWalsh  
          Started by frankthearm, Today, 09:08 AM
          10 responses
          36 views
          0 likes
          Last Post frankthearm  
          Started by mmenigma, Today, 02:22 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by NRITV, Today, 01:15 PM
          2 responses
          10 views
          0 likes
          Last Post NRITV
          by NRITV
           
          Working...
          X