Opening and closing multiple positions after x days

Forums ProRealTime English forum ProOrder support Opening and closing multiple positions after x days

Viewing 3 posts - 1 through 3 (of 3 total)
  • #125681

    Hello everybody,

    I tried to code a system that buys one new position in a stock every month (up to 12 positions) and exits each postion after roughly one year (240 days). The idea is to build up to 12 positions continuously going with the oldest one being sold after 240 days and being replaced for a new one for another 12 months.

    I understand that PRT can only handle cumulated positions instead of managing multiple positions seperately. I am not a good coder and I tried to do it like this, but for some reason after buying all 12 postions the continuous exit does not work out. In the screenshot attached you see the weird exits. I had to set “AddPos” to “9” instead of “20” to end up exiting 20 days after, but I don’t understand the reason for that.

    I would appreciate any help on this. Thanks a lot!

     

    #125686

    Partial closures are not supportrd yet.

    When you you exit ALL open position are closed.

    This feature is planned to be supported, but there’s no deadline.

    1 user thanked author for this post.
    #125691

    TRADEINDEX is exactly that – the index of the last trade whether that be to open a position or to close a position.

    If you have 12 positions open then PRT consider that to be one position at the average price that you purchased all the positions at.

    You are probably better to work with dates and then sell one position at the open of one candle and then buy another at the open of the next candle because if you ever send a BUY and a SELL order on the same candle then they just cancel each other out.

    Partial closure is not possible in real live or demo live trading on PRT so you are working on something that can only be used in back testing at the moment.

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

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