Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter*Limit order + ProfitTarget + reverse position problem

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

    Enter*Limit order + ProfitTarget + reverse position problem

    Hi,
    In my first, simple!, strategy I reach NT limitations:

    Code:
    2008-04-18 00:00:00 Entered internal PlaceOrder() method at 2008-04-18 00:00:00: Action=Buy OrderType=Limit Quantity=1 LimitPrice=207,33 StopPrice=0 SignalName='MyEntryLong' FromEntrySignal=''
    2008-04-18 00:00:00 Ignored PlaceOrder() method at 2008-04-18 00:00:00: Action=Buy OrderType=Limit Quantity=1 LimitPrice=207,33 StopPrice=0 SignalName=MyEntryLong' FromEntrySignal='' Reason='An Enter() method to submit an entry order has been ignore. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.'
    Ideas of strategy:
    - Entry when SMA >/< Close[0]
    - Enter Long/Short Limit orders with price open +/- xx pips
    - Profit Target xxx pips
    - no closing positions, just open opposite or close by ProfitTarget
    - backtesting on 1 day bars

    I used NT sample code from "SampleOnOrderUpdate.cs", I modified it for opening not only long but also short positions and opening not market but limit orders.

    And still my reversal doesn't work - when ShortLimitOrder and ProfitTarget orders are open, new LongLimitOrder order is rejected

    What to do? Please help! it's almost dawn behind the window...

    I already read few threads about similar problem and whole NT "NinjaScript" part of documentation.
    Last edited by Argo1; 09-07-2009, 07:23 PM.

    #2
    Argo1, unfortunately this is expected as you hit the 'Internal Order Handling Rules' with the changes you made to the script - http://www.ninjatrader-support.com/H...verview36.html ( bottom part of this link )

    NinjaTrader 7 will offer a new unmanaged order submission approach offering more flexibility - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

    New Unmanaged Order Submission
    In 6.5 some users were burdened with our "Internal Order Handling" rules. We have introduced unmanaged order submission which bypasses the convenience of our order handling layer. This lower level of programming allows you to do what you want relative to order submission/management without any limitations other than any imposed by your broker. There are only three methods, SubmitOrder(), ChangeOrder() and CancelOrder(). You then get the flexibility of managing your orders how you see fit and optionally handling rejections.

    Comment


      #3
      Bertrand,

      I know this is "Internal Order Handling Rules" case and I can't wait for NT7 - for business purpose.

      So, any workaround for this?

      Is it impossible in NT6.5 to backtest strategy with limit orders with Profit Target and reversing positions?

      In this thread Josh says that something like that is possible (post #2)...

      Comment


        #4
        Argo1, yes, either reverse with market orders are those are not influenced by the order handling rules, or CancelOrder the placed limit orders before reversing, wait for a confirmation of the cancellation and then place the new orders.

        Comment


          #5
          Bertrand,
          I must use limit orders so I try to do it since yesterday.

          Please confirm, if am I right:

          1. I can't use SetProfitTarget() in Initialize() because I must know profit target order id to be able to cancel it manually?

          2. I can't cancel profit target order in OnBarUpdate() and next to open new limit order in opposite direction (in the same bar) because profit order won't be cancelled yet and I will get "Internal Order Handling..." order rejection?

          3. Cancel Profit order should be in OnExecution() method?

          Comment


            #6
            Argo1, this is correct please use the Exit methods in the OnExecution for this - http://www.ninjatrader-support2.com/...ead.php?t=7499

            Comment


              #7
              Not exactly Bertrand
              My 2. i 3. belief was wrong. I just tested:

              in OnBarUpdate() I did:

              Code:
              if(Position.MarketPosition == MarketPosition.Short) {
                CancelOrder(targetOrderShort);
              }    
              entryOrderLong = EnterLongLimit(DefaultQuantity, sigPrice, "MyEntryLong");
              I close profit target order by cancelOrder and immediately open limit order - and it works! I've got reverse position in the same bar.
              I manually opened target profit order in OnExecution().


              Please tell me, what does it mean: "wait for a confirmation of the cancellation" ?

              Comment


                #8
                Thanks for the reply, was this test on sim or live? On live orders the delays can get longer so we advise to check cancellation orderstate first - http://www.ninjatrader-support.com/H...V6/IOrder.html

                Comment


                  #9
                  This is historical data (1 day bars) backtesting.

                  Comment


                    #10
                    Ok, thanks - then the suggestion would still apply to factor in longer / varying delay times for live execution.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    633 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    364 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    567 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    568 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X