Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit Order Cancels if not Filled on Current Bar

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

    Limit Order Cancels if not Filled on Current Bar

    Hello. I am using a simple Moving Average Cross over system.

    Also, I am using Limit Orders for Entries. My problem is if it does not get filled on the current bar, then the order automatically cancels.

    Can you please tell me how to keep the order active until it gets filled?

    Also, I only use the Strategy Builder, as I am not that versed in the code. I hope this can be solved with the Strategy Builder.

    Thank you in advance!


    #2
    Hello geotrades1,

    Thank you for your post.

    Orders submitted by a managed approach strategy are automatically cancelled when the submission bar closes if the order is not filled when isLiveUntilCancelled is false or the overload with the isLiveUntilCancelled parameter is not used.

    When using the Strategy Builder, orders are submitted without using the isLiveUntilCancelled bool and will be false, meaning orders will be automatically cancelled.

    See isLiveUntilCancelled in the help guide.


    To keep limit and stop orders alive, continue re-submitting the order on each new bar for as long as you would like the order to remain alive. Save the limit or stop price to a double variable when the entry condition is true, and this can be used as the limit or stop price of the order on each resubmission.

    Below is a link to an example created with the Strategy Builder that demonstrates saving the order price to a variable and using bools to know when to keep an an exit order alive by resubmitting the order.



    The alternative is to unlock the script and code by hand. With this the method overload signature with the isLiveUntilCancelled parameter can be set to true and the order will not automatically be cancelled.

    EnterLongLimit(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double limitPrice, string signalName)

    Below is a link to unlocked examples that demonstrate.


    Please let me know if this does not resolve your inquiry.​

    Comment


      #3
      Thank you Gaby!

      I will read through this. Hopefully I can figure it out.

      Comment


        #4
        Thanks again Gaby. That is a little complicated for me. I wish there was a video walkthrough?

        Comment


          #5
          Hello geotrades1,

          Unfortunately we don't have a video discussing isLiveUntilCancelled. What exactly are you having trouble understanding? I am happy to provide more clarity.

          Comment


            #6
            OK. I could not figure out what to do based on the example links you sent me. The link for isLiveUntilCancelled, does not show an example of how I would set this up in the Strategy Builder?

            I have attached what I have now (long example).

            Thanks for taking a look!






            Comment


              #7
              Hello geotrades1,

              If the order is being cancelled at the end of the bar, it means it is not being resubmitted on the next bar. Your condition says to only submit the order when MarketPosition is Flat, once the order is submitted your position is no longer flat, meaning on the next bar this condition to submit the order will no longer be true and the order will not be re-submitted.

              You need to modify your logic or add an additional set to allow re-submitting the order on each new bar for as long as you would like the order to remain alive.

              The TrailBuilderExample script in the post linked below demonstrates the order price to a variable and using bools to know when to keep an an exit order alive by resubmitting the order:



              Please let us know if you have any further questions.

              Comment


                #8
                Hi Gaby. Thanks!

                I will look at the link you sent me.


                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                54 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                131 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                73 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                44 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                49 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X