EXITING LONG AND SHORT POSITIONS

Forums ProRealTime English forum ProOrder support EXITING LONG AND SHORT POSITIONS

Viewing 15 posts - 1 through 15 (of 16 total)
  • #178002

    I’m trying to work out the best wat to exit from long and short positions, there seems to be multiple ways to do this and when I back test they produce wildly different results.

    To enter a short position I can use SELL or SELLSHORT (which one is best)

    Once I’m in a short position  I can use BUY OR EXIT SHORT

    IF c4 THEN
    EXITSHORT AT MARKET
    ENDIF

    or

    IF c4 THEN
    BUY AT MARKET
    ENDIF

    Also when I add SHORTONMARKET when using the BUY command to exit a short position this changes the back test result massively when I’d expect it to be the same?

    IF c4 AND SHORTONMARKET THEN
    BUY AT MARKET
    ENDIF

    I must be be missing something about these commands? Please can someone explain.

    #178003
    • BUY opens a Long position
    • SELL exits a Long position
    • SELLSHORT opens a Short position
    • EXITSHORT exits a Short position

    you have no choice.

     

    1 user thanked author for this post.
    #178005

    Thank you.

    Why can’t I use BUY to exit a short position? Isn’t this the same as EXIT SHORT? I now it produces some very different results

    #178006

    You can’t because each one of the above keywords is devoted to only one task.

    1 user thanked author for this post.
    #178007

    Why can’t I use BUY to exit a short position? Isn’t this the same as EXIT SHORT? I now it produces some very different results

    Hi – You sure can, but you’d have to know what you are doing, hence keep track of your current positions very well. Thus, if you are 1 Long, you can SellShort 1 and end up with 0. But if the same SellShort 1 command runs into the situation that you don’t have a position, the result will be 1 short.
    Similarly, if you have 1 Long and SellShort 2, you end up with 1 short.

    Now you’ll understand why this makes a vast difference, and why you should always precede your Buy / Sell commands with determining the current situation (If LongOnMarket – If ShortOnMarket).

    Also notice that

    and

    thus without a quantity, exit the whatever position regardless. You would normally use those, but still first would need to wonder (appropriate If) whether you have the position of concern (Long vs Short respectively).

    Peter

    1 user thanked author for this post.
    #178009

    @PeterSt

    if you have 1 Long and SellShort 2, you end up with 1 short

    no, you will end up with 2 short positions. Sellshort when a long position is open (as well as Buy when a short position is open) will do a Stop & Reverse, so:

    1. the open position is entirely closed
    2. the new position is entirely opened

    no math is done on the different positions.

     

    1 user thanked author for this post.
    #178035

    Thanks guys. I’ve still  got a lot of learning to do.

    #178041

    “if you have 1 Long and SellShort 2, you end up with 1 short“ no, you will end up with 2 short positions. Sellshort when a long position is open (as well as Buy when a short position is open) will do a Stop & Reverse, […]

    Hi Roberto – Interesting. So you are saying that if I have 1 Long and virtually sell 2, I end up with 2 Short ? Thus my transaction of 2 ends up as a transaction with 3 ? It would be a largest bug ever, so that can’t be what you mean.
    You are correct on your #1 and #2 and about the “no math”.

    #178042

    Thanks guys. I’ve still got a lot of learning to do.

    No worries. Me too. 🙂

    1 user thanked author for this post.
    #178045

    If you are Long with 1 position and want to go short with 2, then you’ll end up being short with 2.
    Why 3?
    If you are already Short 1 position and SELLSHORT 2 positions, then you will end up with 3 positions (provided DEFPARAM CumulateOrders = TRUE).

    #178052

    I don’t know where we talk passed each other, but the basis is

    • being long 1
    • sellshort 2

    –> Short 1.

    Apologies if it is my being not clear. 🙂

    #178054

    I think this is what IG enables you to do with multiple strategies with opposite positions opened, you can enable to group them (for a given instrument), thus they will do some math.
    This is not the case with PRT, as opposite positions cannot be opened.
    Try this:

    #178060

    This is not the case with PRT, as opposite positions cannot be opened.

    Correct, but opposite positions are not in order (they are not the subject).

    I made an example too, which is hopefully the most clear for everybody.

     

     

    #178065

    I’m on IG so maybe this was causing some of my problems with results all over with small changes to the code that I expected not to make any difference?

    #178070

    FYI, the result on IG is exactly the same (the previous was IB) :

     

     

    1 user thanked author for this post.
Viewing 15 posts - 1 through 15 (of 16 total)

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