• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 jeronymite, Today, 09:26 PM
            0 responses
            6 views
            0 likes
            Last Post jeronymite  
            Started by ttodua, Yesterday, 06:45 AM
            2 responses
            17 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by franco12364, Today, 08:08 PM
            2 responses
            10 views
            0 likes
            Last Post franco12364  
            Started by smcllr, Today, 06:10 PM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by lupearadu, Today, 01:58 PM
            7 responses
            38 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X