Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Orders

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

    Unmanaged Orders

    When using unmanaged orders, will NinjaTrader allow me to place stops and profit targets prior to entering my position?

    #2
    Hello,

    Thank you for your forum post.

    Yes this should be possible, taking into effect that the market is currently trading between your profit target and your stop. As if your not in a position and a profit target or a stop gets hit this could cause you to have an unexpected position.

    Let me know if I can be of further assistance.

    Comment


      #3
      Error in matching unmanaged orders in strategy analyzer

      Hi,

      I am trying to test a breakout strategy. It generates a long stop and a short stop order after a range is finalized. My understanding is that this requires using unmanaged orders because of internal order rule.

      Now I get it working, but noticed that strategy analyzer matches the filled order by the time they are entered, thus the profit/loss, chart, etc, are all wrong. For an example,

      Num Time Action Order Type Stop State Name
      1. 6/6/2010 9:00 PM Buy Stop 132.87 Filled 1.Long
      2. 6/6/2010 9:00 PM SellShort Stop 130.89 Filled 1.Short
      3. 6/7/2010 6:00 AM Sell Stop 131.10 Filled 1.Long
      4. 6/8/2010 10:00 AM BuyToCover Stop 132.66 Filled 1.Short

      NinjTrade assumes that order #1, #2 are matching orders, and calculate PnL, display trades in chart this way. It ignores the signalName even it is given.

      Would you please help to resolve this error? Is there a way to set position matching using signalName instead of entry/execution time?

      Thanks.

      Comment


        #4
        Hello,


        This is Unfortunately expected with unmanaged orders as there is no tracking based on the signal name with unmanged orders. As the Plot Executions on the strategy analyzer window and the NinjaTrader account PnL is based on the account/strategy position, and not necessarily what your doing with matched or unmatched orders. It will plot indicators and the plot executions based on this fact in the strategy analyzer. There is no way to alter this handling at this time as they plot the raw execution data that results in the account/strategy position when running with unmanaged orders. To separate this out you will need to run separate strategy's, or track these manually.



        Let me know if I can be of further assistance.

        Comment


          #5
          Hi Brett,

          Does NT7 support running multiple strategies in strategy analyzer? I read somewhere there is a plan to support this, but not sure the status.

          Or, can I code a composite strategy which consists of two sub-strategies (both inherited from StrategyBase). Would it work this way?

          Thanks.

          Comment


            #6
            Hello,

            You can only backtest/optimize one strategy at a time in one strategy analyzer window, however you can open multiple Strategy Analyzer windows and backtest multiple strategies at the same time.You could also code multiple strategies into one strategy using the following link for multi series strategies.



            Let me know if I can be of further assistance.

            Comment


              #7
              Hi Brett,

              Multi series strategies sounds like a viable solution. I am looking into it right now. Do you know whether there is a reference sample that I can take a look?

              Thanks.

              Comment


                #8
                Hello,

                Sure please see the below:



                Instead of adding another time frame you would add another instrument, also you wouldnt be getting into a position and out of a position in the example with difference instruments.

                Also, there is a sample MA cross over example in the platform. Control Center->Tools->Edit NinjaScript->strategy->sampleMultiInstrument.

                Also see the following example for intrabar granularity, this imploys the same techniques:

                You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


                Let me know if I can be of further assistance.

                Comment


                  #9
                  I think there is a minor mistake in your documentation:

                  http://www.ninjatrader.com/support/h...nstruments.htm


                  Code:
                  // Primary instrument is MSFT 1 min
                  
                  protected override void Initialize() 
                  {
                       Add(PeriodType.Minute, 3);
                       Add("AAPL", PeriodType.Minute, 1);
                  }
                  
                  The property Positions holds a collection of Position objects for each instrument in a strategy. Note that there is a critical difference here. Throughout this entire section we have been dealing with Bars objects. Although in our sample we have three Bars objects (MSFT 1 and 3 min and AAPL 1 min) we only have two instruments in the strategy.
                   
                  MSFT position is given an index value of 0
                  AAPL position is given an index value of 1

                  I think the position index of AAPL is 2, the same as the BarsInProgress index, i.e. AAPL's position is Positions[2].MarketPosition

                  Your description implies that the Position index and BarsInProgress index are different, which I think is not the case.

                  In the above example, Microsoft has 2 bars objects, BarsInProgress == 0 (1 min) and BarsInProgress == 1 (3 min). My understanding is that the Position is tracked under the index used to submit the trades, i.e. trades submitted under "BarsInProgress==0" would be referenced by Positions[0], but if trades were submitted under "BarsInProgress==1" they would be referenced by Positions[1].

                  At least that is how it seems to work for me. I have a strategy where the primary series is daily, and the secondary is minute. I submit trades to the minute bar series and track positions using the index of the minute bar series, and it works fine in backtesting. I haven't used it to trade live yet.

                  Comment


                    #10
                    Hello,

                    Thanks for bringing this to my attention. I will look into the correct use.

                    Let me know if I can be of further assistance.

                    Comment


                      #11
                      Hi Brett,

                      I went over the code samples. It seems that this approach would not work if the orders (long, short) are for the same instrument. I tried the following code, but only long stop order is entered because of internal order rule. Do you have any suggestions? Thanks a lot for the help!

                      protected override void Initialize()
                      {
                      Add(PeriodType.Minute, 30);
                      CalculateOnBarClose = true;
                      }

                      protected override void OnBarUpdate()
                      {
                      if (BarsInProgress == 0)
                      {
                      ...
                      EnterLongStop(0, false, longTrade.lot, longTrade.entryPrice, longTrade.sigName);
                      }

                      if (BarsInProgress == 1)
                      {
                      ...
                      EnterShortStop(1, true, shortTrade.lot, shortTrade.entryPrice, shortTrade.sigName);
                      }
                      return;
                      }

                      Comment


                        #12
                        chtangwin, you will have to use Unmanaged = true to place opposing orders at the same time.
                        AustinNinjaTrader Customer Service

                        Comment


                          #13
                          This then goes back to square one again. If unmanaged orders are used, PnL, chart, trades will not match. I am giving up at this point. Looks like this is not the feature supported by NT.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Salahinho99, 05-05-2024, 04:13 AM
                          6 responses
                          54 views
                          0 likes
                          Last Post Salahinho99  
                          Started by knighty6508, 05-10-2024, 01:20 AM
                          4 responses
                          26 views
                          0 likes
                          Last Post knighty6508  
                          Started by OllieFeraher, 05-09-2024, 11:14 AM
                          6 responses
                          19 views
                          0 likes
                          Last Post OllieFeraher  
                          Started by PaulMohn, 05-02-2024, 06:59 PM
                          2 responses
                          44 views
                          0 likes
                          Last Post PaulMohn  
                          Started by ETFVoyageur, Today, 02:10 AM
                          0 responses
                          17 views
                          0 likes
                          Last Post ETFVoyageur  
                          Working...
                          X