How do you clear stop orders?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #73382 quote
    juanj
    Participant
    Master

    Good Day, I am writing a strategy that opens stop orders at specific times but I want them to expire or be canceled if certain conditions are met. The defparam flatafter function will not suffice as it is a 24h strategy.

    So the question is how do I cancel stop orders once placed?

    #73384 quote
    Vonasi
    Moderator
    Master

    The manual says set the value to zero but it does not work. Which reminds me that Nicolas was supposed to get back with the answer from PRT regarding that!

    You could just put in something like:

    SET Stop %Loss 100

    Then the instrument would have to go to zero to hit the stop.

    #73391 quote
    robertogozzi
    Moderator
    Master

    Pending orders expire each bar and, if needed, must be placed again and again.

    So DEFPARAM FLATAFTER/FLATBEFORE do not affect them and CUMULATEORDERS=FALSE doesn’t as well.

    If some conditions arise to cancel them, well… just wait the closing of the current bar (you cannot do otherwise, since any strategy is executed only at that very moment)!

    #73392 quote
    Vonasi
    Moderator
    Master

    I think we need to clarify whether you are placing your stop orders on the market via a SET instruction or via a SELL at x STOP instruction.

    I’m guessing the former as otherwise as Robertogozzi says they would just be cancelling themselves anyway.

    #73447 quote
    juanj
    Participant
    Master

    I am aware of the fact that stop orders have to be placed (renewed) on each execution, however, I have found that even after my criteria is no longer met orders are still being triggered.

    I would also love to know how to ‘update’ and ‘cancel’ set stop (stoploss) and set profit (target) levels.

    #73449 quote
    Vonasi
    Moderator
    Master
    Sell at x stop 
    Exitshort at x stop

    These will last only one bar and then be cancelled. If they are still on the market then it is either that your code has placed them again or you have a problem that you should report to PRT.

    SET stop pLoss x
    SET stop $Loss x
    SET stop %loss x

    These are on the market until the position has been closed.

    You can change the value at any time but if you are on a limited risk account then you can only move them closer (don’t get me started on the stupidity of this!)

    There are one or two topics on here about the fact that:

    SET stop pLOSS 0

    is supposed to (according to the PRT documentation) cancel the SET stop but it does not. People normally see fantastic false results if they use a value of zero.

    Nicolas spoke to PRT about this but he keeps forgetting to pass the info on to us. Hopefully after his weekend of rest he will be able to! 🙂

    It is best to either only use Limit and Stop orders and not put them back on the market if you want to cancel one or if using the SET instruction then do what I said in my first post:

    SET Stop %Loss 100
    #73450 quote
    juanj
    Participant
    Master

    Thanks Vonasi! That was crystal!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

How do you clear stop orders?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
juanj @juanj Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by juanj
7 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/15/2018
Status: Active
Attachments: No files
Logo Logo
Loading...