How can I cancel a stop entry order intrabar??

Forums ProRealTime English forum ProOrder support How can I cancel a stop entry order intrabar??

Viewing 10 posts - 1 through 10 (of 10 total)
  • #107907

    Hi all,

    I have the question – can you cancel an stop entry order – intrabar?

    Let’s say I’m running the code below:

    I would like to be able to, let’s say if the buy stop is activated, and the target profit is taken, I would then like to be able to take the sellshort off  the market – all within the same bar – so I’m not left exposed after the profit has already been made.

    I guess I’m putting my own spread on the market, which if it then crosses I’m in profit – either way.

    It would just work a hell of a lot better if I could eliminate my after profit residual risk – the second leg which is a stop that could take my profit away.

    It would be even better if I could eliminate the second stop after the 1st one is activated, regardless of profit.

    Another – bundled – question. I’m doing “buy positionsize contract at close+4.1 stop” – Ideally I want “buy positionsize contract at market+X” – can X be smaller than the market stop size (listed at 4)? If so, how would I code that?

    Thanks for your help,

    Finning

     

    #107910

    Pending orders ALWAYS expire after one bar, all you can do is not to place them, or one of them, if you don’t need it anymore.

    There’s no way to cancel pending orders while a bar is being built.

    The only workaround is to resort to MTF, Multiple Time Frame, support. With it you can use your current TF for setup, while placing orders on a smaller TF, say 1 minute or 10 seconds. Orders would still last a whole bar, but being much smaller they would have a greater chance not to be both triggered on the same one.

    As for your example above be warned that it can only work on some instruments, such as Dax, but not with Forex pairs, since you are not using PIPSIZE to convert pips into a price (profit and loss require a difference in prices). If you want to use pips you should use Ploss and Pprofit, instead.

    1 user thanked author for this post.
    #107923

    The problem with using an MTF faster time frame to place the pending orders is that in for example the 1 second time frame price will slowly creep second by second closer to your order price but once it is under the brokers minimum stop distance then all orders will be rejected and so you will no longer be able to enter at the desired price.

    #107925

    Yes Vonasi, the MTF solution can be mainly appreciated by those who use to set their conditions on a TF of at least 30+ minutes, so that a 1-minute (I do not recommend using a TF lower than that) default TF to place pending orders is likely to be enough to meet the broker’s minimum distance requirements.

    Best options are IMO 1-hour as setup TF and 5-minute or 1-minute as default TF, or a Daily TF for setup and a 30-minute or 15-minute or 10-minute default TF. These are just examples.

    Using a 5-minute setup and a 5-second TF is likely not to work as expected!

     

    #107931

    One possible compromise would be to first of all start placing our two orders on a 1 second time frame so that if in a sudden moment of volatility one of them got hit in a spike then the opposite one was instantly cancelled – but if price slowly creeps up or slowly creeps down towards one of our orders then once it starts to get close and whilst we are far enough away to not get rejected orders then we stop placing the orders every second and switch to placing just one order (the one we are closest to) on say the 5 minute time frame.  This allows our order to remain on the market for five minutes without any possibility of it being rejected. Yes price might reverse and we miss the opposite trade but at least we have removed the risk of opening a trade in one direction only to have it closed quickly and one opened in the opposite direction resulting in a guaranteed loss.

    There’s a coding challenge for someone!

    #107935

    Maybe this (just tested for syntax errors):

     

    1 user thanked author for this post.
    #107941

    The only thing that is missing compared to my original suggestion is that when we switch to the slower time frame we need to only place one order – the one that price is closest to.

    #107948

    Something like this I guess. Not tested.

     

    #108020

    Hi Vonasi/Roberto,

    have attached a code that I’m running at the moment. On the Australia 200 ($1 or $5 market) – but – you must set your time to UTC+10/Brisbane time – so that the code operates in the spread=1 hours.\

    Have had the problem that the platform can’t get/runs out of tick data, and that’s why the test stops where it does. Just have to go through and do different tests at different (x) units, but the test I did shown gives a good number of trades at least in up/down conditions.

    Thank you for your code ideas – I don’t have MTF yet I just have 10.3 on IG – I’ll have to look at trying to get that upgrade then.

    Haven’t fully studied your posts above but I will in detail – just sending this now to add fuel to fire.

    A couple of things:

    • Would be great if you could defeat the market stop limit of 4 – eg – is “If close<close[1]-2 then sell at market” – would this work not as a stop order but just as a market order? Even if it’s the open of the next bar it would be functional – just drop timeframe.
    • And again (I can see that it’s touched on above), being able to buy within that market stop limit of 4 – so effectively being able to buy at “buy at market +2” would open up a whole world of opportunities with this method.

    To be fair I have tried to make this briefly work with FTSE and DAX, but their market structure seems to be a lot more complex (market moves up and down through the open point a lot more in a bar or reverts before a move is completed) – or  – it needs the functionality of the above 2 problems solved would help a great deal.

    I guess what you could call what I’m trying to do a breakout from a spread?

    Cheers,

    Finning.

     

     

    #108024

    Of course the other problem that I haven’t mentioned with this method is the close+4.1 or close-4.1 entry point… you don’t get the reliable fills that you do as what you would have with “at market”. Seems to be a lot of cancelled and amended orders in my trade history. Would be fantastic to have a “at market +2” or “at market -2” functionality – effectively if the market breaks out in a direction at a distance from the current bar’s open – which is what the close+4.1 is trying to do.

Viewing 10 posts - 1 through 10 (of 10 total)

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