Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit Order Keeping Alive or Resubmitting

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

    Limit Order Keeping Alive or Resubmitting

    Hello,

    I have been working on using the enterlonglimit and entershortlimit code from using code snippets from other posts and the resource library. I have enacted the keep order alive until cancelled because I have seen that has been easier for me. I have been trying to find out how to properly add my cancel conditions but I am not sure the best course of action. I know the resource library says to add on orderupdate but when I tried that I seemed to have issues. Is there a way to keep it on bar update and change how its coded? Or is it better to switch this to resubmit the order until my other conditions are no longer true? Should the logic be added in the same if bracket { logic here} on bar update or do I create its own somewhere else?

    I am unable to share the actual code because I had someone work on it last year. It is a managed approach but then internally there is also a lot of conditional order placement codes built in (not sure if that's the proper terminology). Is there a way for me to add those conditional order placement ideas without explicitly using a limit order then? If so, I could create the bool values and then it would submit the market order when it reaches my proper pullback that I wanted.

    Once all my order conditions are true currently I will place a limit order at the Low[2] or high[2]. All of this is working properly but what I want to have happen is to cancel the order if Close[0]>=Profit Traget1 or Bars since signal is >= user defined # or time is after my specified close.

    There used to be an old piece of code I found but cannot find anymore that I believe would have been able to answer my questions but I cannot find it on the forum anywhere at this popint

    Any help pointing me into the right direction is appreciated!


    #2
    Hello durdcash,

    There is an example of trailing / chasing logic that would have all of this in it: assigning orders to variables in OnOrderUpdate(), cancelling orders, keeping Exit orders alive with isLiveUntilCancelled as true, etc.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_ChelseaB thanks for providing that but I am not sure if that's what I was looking for at first glance.I will take a look at them in more detail later today and see if they are able to provide the proper insight

      Comment


        #4
        NinjaTrader_ChelseaB I have dug a little deeper and might be able to switch up some of the logic and rework it for my strategy. Would I need private void AssignOrderToVariable, OnOrderUpdate, and OnExecutionUpdate for this to function properly or can any of these be done without when I go and code it to test? Essentially so I could make sure one piece is working before I move to the next piece?

        Comment


          #5
          Hello durdcash,

          The AssignOrderToVariable() assigns the order object from OnOrderUpdate() to a variable, so that the order can be modified in OnBarUpdate().
          This is called from OnOrderUpdate(). You do not have to have a separate method for this, but if you want to modify an existing order with ChangeOrder() assigning the order to a variable would be necessary.
          OnExecutionUpdate() is where the stop is first being submitted when the entry order fills. If you do not want to submit the stop when the entry order fills, then this override would not be necessary.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            NinjaTrader_ChelseaB thank you for the clarification. Now if I want to cancel the order after a number of bars are passed, will I want to use on order update or can that also be done on bar update if done properly? I do not use the set method and use internal on bar update code to trigger my stops, targets, and what not.

            Comment


              #7
              Hello durdcash,

              To cancel an order, you will need to assign the order object to a variable in OnOrderUpdate(), then supply the variable holding that order to CancelOrder() in OnBarUpdate().
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              65 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              139 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              75 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              50 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X