am not able to partially close a short position

Forums ProRealTime English forum ProOrder support am not able to partially close a short position

Viewing 6 posts - 1 through 6 (of 6 total)
  • #5266

    I have the following code:

    I want to close just 1 of 3 contracts.. but the code above, when positionperf reaches X %, closes the whole position.

    According with the ProBackTest manual, it should work but it doesn’t:

     

    Manual says, pag. 9 / 92

    Entering and exiting the market

    Different instructions are used depending on the type of position:

    Long positions:

    BUY is an enter long position instruction (Buy securities)

    SELL is an exit long position instruction (Sell securities)

    BUY allows you to open a long position on the market or add to an existing open position. It is associated with the instruction SELL which allows to close or partially close a position. The instruction SELL has no effect if there is no long position open.

     

    Some advice please?

    #5268

    Hello lasmiveni,

    POSITIONPERF gives you the position performance of the last N position //edited by Nicolas

    Also, if you try to partially close position with IG, it is not possible as they don’t allow it actually.

    In your code I don’t see anything that can close a buy or a set of buy orders. You should use SELL to close a long position.

    #5280

    am getting confused, into the manual I read the following info about PositionPerf:

    PositionPerf
    The instruction POSITIONPERF(n) returns:

    The performance (ratio gain/cost of the position) of the n-th last position closed if n>0 (not including brokerage fees)

    The performance (ratio gains/cost of the position) of the currently open position if n=0 (not including brokerage fees)

    If n is not specified, we suppose that n=0. PositionPerf=PositionPerf(0).

    Can you please explain better?

    good to know I can’t partially close positions with IG, even if PRT manual says I’d be able to do it.

    In my code I wanted to partially close a Short Position, it should work viceversa too I guess.

    #5286

    PRT manual is the ProRealTime software manual instructions, not the way how broker deal with their proper orders books. But you’re right it is not clear in the manual for sure 🙂

    About your first message of the thread, to close a SHORT position you should use EXITSHORT, not BUY which is used to open a new long position.

    And for the PositionPerf behaviour, I’m gonna investigate why it is described as you mention it because I were pretty sure it were not possible to get the actual position performance …

     

    #5288

    Well, you were absolutely right.

     

    Return the performance of the actual opened order. Sorry for inconvenience! my bad … 🙂 I have changed my first message to be clear for anyone reading this thread in the future.

    #5291

    ok, thank you Nicolas for ur quick reply,

    I simply thought, since manual says I can partially close a SH or LG position, buying or selling only a certain amount of contracts,

    that EXITSHORT is not the right syntax to use because sells the whole lot.

    So I tryed to use just SELL… btw there’s not a right syntax here cos IG doesn’t allow to do that.

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

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