How to get the current points ahead or behind in code

Forums ProRealTime English forum ProBuilder support How to get the current points ahead or behind in code

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

    I would like to vary a trailing stop loss mid-trade depending on the current points ahead / behind of the trade, but I can’t seem to find the constant in the coding window function help. Does anyone know if this exists or how I can derive this value?

    Thanks in advance.

     

    #162899

    Something like this?

    Simply check the difference between the current close and which price the last order was executed.

    1 user thanked author for this post.
    #162921

    Mattias’s suggestion will only work for long positions so you will need to use the reversed calculation for short positions:

    Also if you have multiple positions open at multiple prices then it won’t work.

    You should consider using COUNTOFPOSITION with POSITONPRICE or POSITIONPERF in a calculation.

    https://www.prorealcode.com/documentation/countofposition/

    https://www.prorealcode.com/documentation/positionprice/

    https://www.prorealcode.com/documentation/positionperf/

    3 users 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