ProBacktest – Exit doesn't work

Forums ProRealTime English forum ProOrder support ProBacktest – Exit doesn't work

Viewing 2 posts - 1 through 2 (of 2 total)
  • #95455

    Hallo,

    in my script below the exit doesn’t work correct and I don’t know exactly the reason. The main problem is that a position closes everytime at the next bar, except for the last open position. The script should be some kind of template, in which I can easy change conditions like longentry, stop etc..

    Important:

    • Test parameters should be defined in the input section
    • Only one position at the same time
    • longentry and shortentry are just an example – It should be possible to change these inputs easily
    • In this script longexit and shortexit is fixed depending on bars- If longentry and shortentry triggers, I want to keep the position oben for several bars.
    • The other inputs like stop, take profit, direction, position size and date should remain and work in each case.

    Why is the position open for only one bar even if I define nrbars = 10?

    Thanks and best regards

     

    #95470

    your “lexit” and “sexit” variables are always true, that’s why you are exiting directly the orders at next bar.

    If you want to exit orders depending of how many bars have elapsed since their inception, you should subtract the actual barindex to tradeindex. There are many examples on forums, “exit after n bars …”, etc.

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

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