Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto-adjusting unfilled limit entry order in the following bar[s] until filled

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

    Auto-adjusting unfilled limit entry order in the following bar[s] until filled

    Hello,

    For a custom strategy, I am trying to code limit entry orders that are based on a moving average plus or minus an ATR-based range.

    If the order is not filled in the first bar in which it is entered, though, I would like to cancel that old limit order and enter a *new limit order* that is based on the *new moving average value* plus or minus the *new ATR-based range* [all of these will have changed in the next bar]. If that new one does not fill, I would like to cancel and again re-enter a new limit order in the next bar [etc].

    Would you have any particular recommended approaches for this?

    If you have an approach in mind, I would really appreciate it. I googled but didn’t see this question answered in the forums.

    Thank you,

    #2
    If your limit entry order is unfilled,
    I assume you are capable of calculating the new price for the new entry order yourself.
    Are you able to calculate this MA value + ATR offset already?

    Anyways, don't cancel the original limit order and create a new one.
    Just use ChangeOrder and update the price of the original limit order.

    Btw, is this Managed or Unmanaged mode?
    (This may not matter much, since ChangeOrder is the same for both.)

    Comment


      #3
      Hey, thanks for the help.

      Yes, I am able to get the new MA & ATR value. Looking briefly at a documentation page, it appears I am using Managed Mode.

      Comment


        #4
        Great, when you detect the need to update the limit entry order, try calling ChangeOrder,
        just use the Order handle for the original order, specifying the new LimitPrice, but use
        the original Quantity and StopPrice of 0.

        Comment


          #5
          Hello catinabag, thanks for your question.

          I agree that ChangeOrder would be the best thing to use to change an order. Note you must have a class level order object that should not be null before calling ChangeOrder. There is an example of setting up an order object and checking for null here:
          https://ninjatrader.com/support/help...#TheOrderClass

          Kind regards.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Thank you -

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by tradingbobby, Today, 10:41 PM
            0 responses
            2 views
            0 likes
            Last Post tradingbobby  
            Started by bfalls, Today, 10:38 PM
            0 responses
            3 views
            0 likes
            Last Post bfalls
            by bfalls
             
            Started by WHICKED, Today, 09:05 PM
            0 responses
            11 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by luislag14, Today, 06:29 PM
            0 responses
            8 views
            0 likes
            Last Post luislag14  
            Started by Protech, Today, 11:08 AM
            1 response
            23 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X