Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:


          Kind regards.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Thank you -

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            23 views
            0 likes
            Last Post algospoke  
            Started by ghoul, Today, 06:02 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            45 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            21 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            181 views
            0 likes
            Last Post jeronymite  
            Working...
            X