Cancelling pending orders

Forums ProRealTime English forum ProOrder support Cancelling pending orders

Viewing 15 posts - 1 through 15 (of 19 total)
  • #148591

    Good evening, I’m having a similar issue and tried various combinations but couldn’t solve it. I’m running a small programme on TF 15 minutes. I’ve read a few posts thanks to Nicolas which say that non executed STOP Orders are cancelled at the end of the candle. This doesn’t work in my case. So I tried to add the following lines and still doesn’t cancel the pending orders. The objective is to auto cancel the non executed orders at the end of the 15 minutes candle. I’m really stuck and this results either in keeping orders with irrelevant conditions. Please help me see clearer. Many thanks.

     

     

     

    #148596

    Pending orders are automatically cancelled every bar.

    If  one of them keeps being placed again is because somewhere you have written your strategy to.

    1 user thanked author for this post.
    #148598

    Thank you Roberto for taking the time. Can you please help me with what’s wrong in my code that makes the pending orders alive after the end of the 15 minutes candle? Much appreciated.

     

    #148599

    Roberto, can it be the pTRAILINGSTOP that keeps the pending order alive after the end of the candle? Thanks

    #148600

    No, it’s because at line 36 the only condition to enter a trade is NOT ONMARKET, so when this condition is true it opens a new position.

    You need to add another condition. When do you want your trades to be opened?

     

    1 user thanked author for this post.
    #148602

    Roberto, you’re “l’As des As”, THE MASTER! It was simple, but it kept me awake for a few days… Thank you so much!!!!

    #148677

    Roberto, I’ve spoken a little bit too quickly I think. I’ve tried a few conditions to enter a trade and the problem persists: pending orders are not cancelled at the end of each candle, and I keep carying a pending order with irrelevant entry conditions for a few hours. So, I’ve just removed all the conditions to trigger a trade and the result is the same. I stopped the Algo after the Orders have been sent and still they are not cancelled. Below you will see a snaphopt of two pending orders on 3min TF. The most recent is the Short one (3.18pm), but the Long (3.15pm) should have been cancelled.

    The most important question for me is how to get the pending order cancelled, not how to get a new one executed.

    Thanks for your help.

     

    #148686

    Pending orders ARE ALWAYS cancelled every candle (in your case every 15 minutes). If you don’t focus on this you will never be able to understand why this happens.

    If ProOrder keeps placing them is because your strategy KEEPS placing them again and again.

    You were using only NOT ONMARKET, which is true whenever there’s no open position. So I suggested you to add another condition to filter entries and you replaced NOT ONMARKET (instead of adding a new one) with CONDITION=1  which is set  at the beginning and NEVER changes, so it will always be true candle after candle and pending orders will be entered each time. That’s why nothing changed.

    Choose a condition that makes sense to you and use it. YOU know what condition must be used, I can’t be of any help, just as an example I could write:

    I used two conditions, but you can use just one or add more.

     

    #148695

    I decided to make a topic of its own because:

    • the subject is a little be different
    • the topic is growing

     

     

    1 user thanked author for this post.
    #148706

    Thank you Roberto. Are you saying that as far as the conditions for entry stay the same, the pending order is not cancelled?

    Example:

    if I understand what you said: if the Close stays above the SMA200, the pending order stays active?

    Thanks

    Khaled

     

    #148713

    I don’t know how to explain that!

    As I already said twice, pending orders are ALWAYS cancelled when a bar closes. You need to be  aware of this, because you think a pending order has to be cancelled, while the opposite is true… you have to place again a pending order when you need to. Forget about cancelling them, ProOrder gets rid of them  automatically when a bar closes!

    In your example if the next bar is Not OnMarket and Close > average[200,0](close), a NEW pending order (the previous one has already been cancelled automatically by ProOrder)  is placed.

    Instructions within IF…ENDIF are executed when  the condition (or more than one) is true. If your conditions are true bar after bar, then a pending order (or more than one) will be placed again bar after bar.

     

    1 user thanked author for this post.
    #148718

    Dear Roberto,

    First, I want to really thank you again for taking the time to answer my questions. I’m a beginner and may ask candide questions and I hope one day I’ll be in position to generously help others, like you do.

    Secondly, I understand your point but as you can see on the screenshot I’ve attached above, it shows two pending orders, created with the same Algo running under 3min TF, the first generated at 3.15pm and the second generated  at 3.18pm, meaning that the first Order has not been cancelled at 3.18pm despite the closure of the previous 3min candle. If the first order was cancelled automatically and has been replaced by a new one at the smae price conditions, then it would show the 3.18pm timing instead of 3.15pm.

    I didn’t want to bother you with so much details, but below is the complete code of the Algo that doesn’t work as expected, may be something wrong with my coding skills or the order of appearance of the instructions. This code is largely inspired from https://www.prorealcode.com/topic/machine-learning-in-proorder/page/26/#post-129120

    Again, my concern is that the pending orders are not cancelled automatically at the end of each candle.

    Your help is much appreciated.

     

     

    #148720

    There are some basic programming rules that we cannot discuss further here, such as IF…ENDIF and conditions. I already explained you basically what it is all about and you continue adding conditions that are ALWAYS true. What sense does it make writing:

    and complaining again and again about pending orders not being cancelled! C1 is set to 1 initially and NEVER changes, but you still keep it as a condition to place a pending order. Why after the first time, ProOrder should not place it again and again…. ?

    Pending orders ARE automatically cancelled (I will stop replying to you until this is clear, there are tons of examples and topics about this, beyond official documentation and forum searches).

    It’s YOU who have coded you strategy so that it places pending orders continuosly.

    I can help you code your conditions if you can’t, but you need to tell me WHICH are those conditions that you need for a pending order to be PLACED (not cancelled, forget about cancelling them and focus on how to place them).

     

    1 user thanked author for this post.
    #148727

    Khaled, let me also try to explain, may be you will get it.

    Your condition to buy is

                     

     

    For first candle, when C1=1, your strategy places one stop order, which stays active for the duration of the candle, and gets cancelled if not fulfilled during that candle’s lifetime.
    Then for second candle again, C1=1 and an exactly similar order gets placed (to you it seems like same order as earlier), and just like above, gets cancelled if not fulfilled during that candle’s lifetime.
    And this loops continues at every candle as long as C1=1.
    Your problem is that C1(or C2) never gets updated…so, as Roberto has advised, unless you write a logic to update your conditions, you will keep on seeing the issue.
    Hope it helps….kaq
    1 user thanked author for this post.
    #148729

    Thank you Kaq. I get the point. Just want to understand then why the time of the first order doesn’t change, order that is supposed to be cancelled and replaced by another order at the same price conditions doesn’t change? stays 3.15 pm, while the most recent order is marked 3.18pm? This is what leads me to think that the first order is not cancelled. I’m not arguing or whatsover, I’m just trying to understand and learn properly.

Viewing 15 posts - 1 through 15 (of 19 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login