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

Which Strategy Start Behavior to Use

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

    Which Strategy Start Behavior to Use

    I am setting up multiple strategies to run at different times of the day. Part of my rules are that when one of the new strategies starts because of the time, any existing positions should continue to run based on the strategy that started them.

    For example, Strategy 1 starts at market open at 9:30 am EST. The strategy places a trade with 3 take profits, 4, 8 and 12 points for example. The same stop loss is used for all three take profits.

    At 10:30 am EST, strategy 2 starts. At this time, strategy 1 is still in progress with the 8 and 12 point profit targets still working.

    Strategy 2 has 2 options.

    Option 1: strategy 2 places orders as soon as its signal triggers, regardless of any other active trades. And it doesn't effect those open orders in any way.
    Option 2: strategy 2 waits until strategy 1 open orders have run their course. Once strategy 1 orders are closed by strategy 1, strategy 2 will enter a trade on the next valid signal.

    How would I set this up using the strategy start behavior parameters?

    Thanks.




    #2
    Hello GoldBands,

    Welcome to the NinjaTrader forums!

    Likely, you would want to use the AdoptAccountPosition Start Behavior. Below is a link to an example.
    https://ninjatrader.com/support/foru...29#post1068829

    Note, the start behavior only occurs at the time the strategy is started. If the Strategies are already enabled and using time filter conditions, you would need to use another solution (likely through the Addon approach).

    Further, orders and positions created by a strategy instance, will not be available to other strategy instances.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Which Start Behavior should I use if I have an active position and need to turn the strategy off to adjust some parameters before the next position is initiated by the same strategy. Like changing the strategy filter for long or short trades? I had a developer write the strategy for me but he is not available to make any code changes. Is there a specific start behavior I could use?

      Comment


        #4
        Hello GoldBands,

        What do you want the strategy to do?

        Do you want it to (re)calculate historical orders?

        Do you want to adopt the strategy position to match to an open account position?

        Do you want the account position to be synchronized to the strategy position?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I want it to do nothing until the next trade signal comes in. That will close the existing trade (if it's still in progress) and start a new trade.

          Comment


            #6
            Hello GoldBands,

            If you want no action, and you do not want the account and strategy positions synchronized, use the Immediately Submit Start behavior.

            This will assume the position is correct and the first real-time trade will be submitted live (even if the strategy and account are out of sync).
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Unfortunately, Immediately Submit doesn't work either. As soon as I enable the strategy, it automatically cancels all take profit and stop losses. It does leave the order intact but "orphaned" from the stop loss and take profit. I want those to be left intact as well when enabling a new strategy.

              Comment


                #8
                Hello GoldBands,

                If the orders are not matched when the strategy is re-enabled, they will be cancelled. There is no way around that with a NinjaScript Strategy.

                From the help guide:
                "Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued."
                * A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical.

                Below is a link to a forum post on resuming a strategy.


                If you aren't planning to match orders and you want the unmatched orders to not be cancelled, you would want to use the Addon approach instead of a NinjaScript Strategy.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Segwin, 05-07-2018, 02:15 PM
                14 responses
                1,789 views
                0 likes
                Last Post aligator  
                Started by Jimmyk, 01-26-2018, 05:19 AM
                6 responses
                838 views
                0 likes
                Last Post emuns
                by emuns
                 
                Started by jxs_xrj, 01-12-2020, 09:49 AM
                6 responses
                3,294 views
                1 like
                Last Post jgualdronc  
                Started by Touch-Ups, Today, 10:36 AM
                0 responses
                13 views
                0 likes
                Last Post Touch-Ups  
                Started by geddyisodin, 04-25-2024, 05:20 AM
                11 responses
                63 views
                0 likes
                Last Post halgo_boulder  
                Working...
                X