Are pending orders remains when one is hit?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #124878 quote
    Dr Manhattan
    Participant
    Senior

    Hi, a very very basic question, what happens with the sell order when the buy order it hit? if it remains can I get rid of it?

     

    IF NOT OnMarket AND c1 THEN
       BUY 1 CONTRACT AT HIGH STOP
       SELL 1 CONTRACT AT LOW STOP
    ENDIF
    #124884 quote
    robertogozzi
    Moderator
    Master

    It remains till the bar closes.

    When a bar closes ALL pending orders are cancelled and you need to place them again, if needed.

    Be warned that SELL does not open a Short position, it closes a Long one.

    To go short use SELLSHORT and to close it use EXITSHORT.

    #124885 quote
    Dr Manhattan
    Participant
    Senior

    Thanks, I think the problem I have is that the buy get hits in the beginning of the bar, then I want to get rid of the sell but in the in the _same bar it hits the sell before the next opens.

    Is it possible to do the following in the same bar?

    SELL AT MARKET
    SELLSHORT AT MARKET
    #124887 quote
    Dr Manhattan
    Participant
    Senior

    No wait! Hahaha, I was using sell instead of Sellshort in one place! 😀

    #124898 quote
    Vonasi
    Moderator
    Master

    Still as Roberto said it is possible for your buy order to get filled and then price reverse and hit your sellshort order which will then close your long position for a loss and then open a short position all in the space of one bar.

    You could do something using MTF like this on a faster time frame such as the 1 second time frame. This will however seriously limit the amount of data available for your backtest.

    timeframe(1 second)
    if not onmarket then
    buy 1 contract at LongPrice stop
    sellshort 1 contract ShortPrice stop
    endif
    Dr Manhattan thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Are pending orders remains when one is hit?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Vonasi
5 years, 10 months ago.

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