Code for partial closures by percentage.

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

Currently, there are 0 users and 1 guest visiting this topic.
View all attachments
Viewing 6 posts - 1 through 6 (of 6 total)
  • #185903 Report

    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 Report

    There you go (not tested):

     

    #185908 Report

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

     

    1 user thanked author for this post.
    #185923 Report

    Thanks boys.

    #186018 Report

    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 Report

    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