"EXITSHORT" command not closing a short position

Forums ProRealTime English forum ProOrder support "EXITSHORT" command not closing a short position

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

    Hi there,

    I am running the code below, which is meant to exit a short position if it closes above the 50EMA, and then quit the code.

    The command to exit the short and then quit is at the bottom of the code below. Strangely, it successfully quits the code, meaning it must be running the code within this IF statement, but it does not exit the short position. Instead it quits the code and leaves the position open. Can you help me figure out why?

    Many thanks

    Chris

     

    #19300

    Hi Munkanu

    Try below and let us know how you get on.

    Cheers
    GraHal

    #19303

    Hi GraHal,

    Many thanks for your reply. I have tried this and still get the same result – the code quits (meaning the IF statement seems to be working) but the short position is left open (meaning the EXITSHORT command) does not seem to be working. Very odd.

    Not sure what to try next as the code looks fine, can anyone help? Am I missing an argument on the EXITSHORT command?

    Many thanks

    Chris

     

    #19304

    I’ve never used “quit” pretty much at the same time as sending an order, so I’m only wondering here, rather than talking from experience: could it be that “quit” is instantaneous in such a way that the “exitshort at market” order is cancelled at the same time as exiting the strategy before it has any chance of being executed? Might be worth trying to delay your “quit” instruction by at least one candle after sending the exitshort order, just to see if it gives more time for the exitshort order to happen…

    #19307

    To delay by one candle, many ways to do it, but for example something like this should allow for the experiment:

    adding at the beginning of the code :

    and modifying the end with:

     

    1 user thanked author for this post.
    #19314

    Thank you Noobywan – good point about the quit command. I’ll just remove it for now and see if it makes a difference, then will try your code suggestion. I’ll update tomorrow.

    Best regards

     

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