Code for partial closures by percentage.

Forums ProRealTime English forum ProOrder support Code for partial closures by percentage.

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

    Good.
    I needed code for multiple partial closures within one operation.

    If the operation is positive and earns equal to or more than 0.25%, close 1/5 of the position.
    If the operation is positive and earns equal to or more than 0.5%, close 1/5 of the position.

    It’s an example, thanks.

    #185906

    There you go (not tested):

     

    #185908

    Here’s another version (also coded by Roberto👍)

     

    1 user thanked author for this post.
    #185923

    Thanks boys.

    #186018

    I’m sorry, but in Roberto’s code, line 5, it doesn’t matter if I put 0.25, 0.5, or 1, he always wins the same in backtest.

    I think the code is not working properly.

    #186037

    Sorry, there are two mistakes:

    • I typed CLOSE in line 6 and 10 instead of SELL (or SELLSHORT)
    • line 4 should read
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