Add new position when + 50 points

Forums ProRealTime English forum ProOrder support Add new position when + 50 points

Viewing 12 posts - 1 through 12 (of 12 total)
  • #175402

    Hello

    I am looking for a code that means that if I am +50 points, another position is opened with 1 contract.

    But it should not be repeated more than once so max position size = 2.

    Like this maybe?

    #175413

    This will buy 1 contract, when no position is open, and buy one further contract when the closing price of the first position is at least 50 points in plus. Not tested, however. Will work for indices, but I’m not sure about forex because they work with pips there.

    2 users thanked author for this post.
    #183010

    Have previously asked about a new position be opened.

    But it does not work.

    It opens new positions all the time.

    I want only 1 more position to be opened when my position is +40 points.

    And the new position will be closed at the same time as the first

    Does anyone know what such a code looks like?

    #183026
    JS

    Try: Defparam cumulateorders = false (instead of true)

    #183027
    JS

    You can also try: abs(countofposition)

    #183029

    Try this.

    At current prices, positionprice * 1.0025 on the DAX is approx a 40 point gain. You can change the multiplier depending on what instrument you want to use.

    It should make your backtest more accurate, as it keeps your gain relational to the historical index value.

     

    1 user thanked author for this post.
    #183031

    Thank you n.

    The code works.

    A maximum of 2 positions are taken 🙂

    But sometimes the second position is taken at +40 points and sometimes at + 120-130 points.

    How is it that..

    #183032

    What instrument are you using?

    you could try

    or if you don’t mind if it’s not proportional you could just use

     

    #183033

    Nasdaq

    #183035

    I try that.

    Thanks

    #183037

     

    And short looks like this?

     

    #183043
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    if not onmarket then
    flag = 1
    flagS = 1
    ENDIF
    IF not shortonmarket and condsell THEN
    sellshort positionsize CONTRACT AT MARKET
    elsif shortonmarket and condsell and flagS and LOW <= (positionprice 40) then
    sellshort positionsize CONTRACT AT MARKET
    flagS = 0
    ENDIF

     

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

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