Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can Strategy #1 disable Strategy #2?

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

    Can Strategy #1 disable Strategy #2?

    Can My Strategy #1 disable a proprietary Strategy #2 while #1 is on a trade, and then re-enable Strategy #2 after #1's trade has closed?

    If #2 is on a short trade, can #1's subsequent short entry automatically add on to it and take over the ATM of both trades, instead of allowing #2 to follow its ATM? (I can't alter Strategy #2).

    #2
    rcollen, this would unfortunately not be possible since the scripts would not be able to cross communicate. Have you considered controlling everything from one script that would just have multiple entry signals then?

    Comment


      #3
      Thank you Bertrand. That could be an option. Would it be possible to have the proprietary Strategy #2 drive a parallel SIM account with small stops and targets and just link its entries to My Account which was driven by Strategy #1? My Strategy #1 could have multiple entry signals that could incorporate the #2 entries and assign them a different exit pattern than they had in #2. Correct?

      Comment


        #4
        Hello rcollen,

        Thank you for your response.

        I see what you are attempting with that idea, but unfortunately the strategy set to the sim account would only be able to send orders to the sim account. You could just incorporate the strategy into one as Bertrand suggested.

        Comment


          #5
          Thank you Patrick.

          I guess I am confused by "incorporate." I believe that I cannot dismantle the proprietary strategy #2. I can only adjust the profit and loss parameters. When it takes a trade, sometimes I want:
          1). To have My Strategy #1 take a counter trade which would reverse (OCO) Strategy #2's trade, and then possibly to have #2 counter again and reverse the #1 trade; or else,
          2). Sometimes I want to add-on to #2's trade and change its target and stop management. During the duration of these add-on trades, I do not want Strategy #2 to take another trade and prematurely alter the course of the new trajectory. In these cases, Strategy #2 should only take further trades from a flat position.

          Is it possible to do this?

          Comment


            #6
            Hello rcollen,

            Thank you for your response.

            This would be possible within one strategy. You would need to develop conditions that will close one position and open another when needed and ensure that no additional trades are added to the trades for whatever positions you do not wish to have additional add-ons.

            Please let me know if I may be of further assistance.

            Comment


              #7
              Great, Patrick. I am honing in here. I now see that I can run two strategies simultaneously, and run the proprietary #2 with larger stops and targets than #1 so that #1 will essentially handle the management of the trade that #2 initiates. In that case, #1 can add-on as determined by #1's conditions.

              However, If #2 initiates a long, and #1 adds-on to the long trade, and the trade proceeds, but then #2 initiates a short before #1's target has been met, can I create conditions in #1 that allow it to ignore #2's short until the long trade has completed it's target according to #1's conditions?

              Comment


                #8
                Hello rcollen,

                Unfortunately, that would not be possible.

                Comment


                  #9
                  Thanks very much for your thoughts on this, Patrick. Let me bark up this tree one more time before I abandon this thread.

                  I do not want to dismantle, mess with, resell or otherwise violate my license agreement with this proprietary strategy #2. It consists of 2 proprietary indicators and outputs a buy or sell signal when they line up. Every time one of their significant events happens, the indicators print a dot on the chart. Two dots on the same bar of the 2 indicators, and the strategy #2 places an order to buy/sell.

                  I would like to simply re-direct these output signals into my own strategy so that I can elaborate upon their use. This is for my personal use only. Can the signal output go into a file in my RAM in real time, and this file then read in real time by some script that I write for NT that can access this file for use in My Strategy #1? Or something like that.

                  Comment


                    #10
                    Hi rcollen,

                    It is possible to have an indicator or strategy write to a file but you would need to code that into the strategy.

                    You have mentioned that the strategy is proprietary and you will not be able to modify it so this will not be an option for you.

                    The indicators may be giving signals that you can you in your own strategy. The easiest way to find the public variables from which you can get these signals would be to view the code of the indicator, but again this will not be an option.

                    You basically will need to call the indicator in a script and use the intellisense to look at all of the public objects of that indicator and use trial and error to find if one or more of these objects has information you can use.

                    For example, if I were to type MACD(5, 5, 5) and then add a dot to the end the intellisense will open and list the available objects. In this list I can find the .Avg plot which I can use in my script, the .Diff plot, and the .MACD plot.

                    There will likely be a lot in the intellisense list but without viewing the code of the indicator you will have to guess or use trial and error to find out if they are plots or signals you can use.
                    Attached Files
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Thank you very much for all your replies. Your team is fabulous. You have really shaped my journey from what I imagine to what is really possible. I am working with Bertrand's suggestion to "incorporate." This means that I run 2 strategies at the same time on the same instrument on the same account. If I can successfully create a strategy #1 to incorporate Strategy #2, can I back test the pair together?

                      Comment


                        #12
                        Hi rcollen,

                        Incorporating a strategy into another strategy would mean that you only run one strategy.

                        The idea is that instead of running two scripts on the same instrument and same account which will cause position conflicts, he is suggesting you move all code for both scripts into one script. This is one script incorporating another so that you do not run two.

                        With one strategy you have a strategy position that would match the account position which is separate. All trades for both logic would be handled by one script instead of two.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          However, Strategy #2 is an inviolable proprietary strategy and the vendor will not allow me to access his script. But I can write my Strategy #1 to run alongside his #2 and respond accordingly. I know that running 2 strategies in NT on the same instrument on the same account is functionally possibly. If #1 initiates a long trade, and #2 follows with a short trade, #2's trade will close #1's and open #2's (OCO).#1 can be programmed such that If #1 does not want that trade, #1 can then immediately close #2's trade and re-open its long trade. And variations of this logic.
                          My only assumption is that #1 can determine immediately when and in what direction #2 has entered a trade. I presume this is possible since they are both on the same account.
                          My question is whether the 2 paired strategies can be backtested at once.
                          Thank you.

                          Comment


                            #14
                            Hi rcollen,

                            You can backtest two scripts at once, but they are asynchronous and they will not communicate with each other.

                            There is an unsupported method to query your account position. This does not trigger a method in NinjaScript and you will have to call and check this.

                            This does not work at all in backtest.


                            Code:
                            foreach (Account acct in Cbi.Globals.Accounts)
                            {
                            if (acct.Positions != null)
                            {
                            // print information about each position
                            PositionCollection positions = acct.Positions;
                            foreach (Position pos in positions)
                            {
                            Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
                            }
                            // print information about each order
                            OrderCollection orders = acct.Orders;
                            foreach (Order ord in orders)
                            {
                            Print(ord.ToString());
                            }
                            }
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Thank you, Chelsea. I think I can deal with this. I have looked into backtesting two strategies at once but I must have overlooked something. How do I do this?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              648 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              369 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              572 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              574 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X