Stop trailing distance reduced

Forums ProRealTime English forum ProOrder support Stop trailing distance reduced

Viewing 10 posts - 1 through 10 (of 10 total)
  • #233151

    Hello,

    I use a 20 pips trailing stop. I want it to be reduce as gain is rising. But it stay at 20 pips. How can i fix it ? Thanks

    // Trailing Stop Conditionnel
    IF longonmarket THEN

    IF positionperf > 50 THEN
    SET STOP pTRAILING 8
    endif
    IF positionperf > 30 THEN
    SET STOP pTRAILING 10
    endif
    if positionperf > 20 THEN
    SET STOP pTRAILING 15
    endif
    SET STOP pTRAILING 20
    ENDIF

    IF shortonmarket THEN
    IF positionperf > 50 THEN
    SET STOP pTRAILING 8
    endif
    IF positionperf > 30 THEN
    SET STOP pTRAILING 10
    endif
    if positionperf > 20 THEN
    SET STOP pTRAILING 15
    endif
    SET STOP pTRAILING 20
    ENDIF

    #233155

    You have almost unreachable figures against PositionPerf.

    PositionPerf is a %

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

    1 user thanked author for this post.
    #233156

    how can i fix it then ?

    #233158

    Consider 50 points gain … what is that as a % of instrument price?

    So for DJI at 40000 … 50/40000 = 0.000125.

    So – for DJI at 40,000, you need …

    IF positionperf > 0.000125 THEN
    SET STOP pTRAILING 8
    endif

    The Instruction I linked to above is incorrect when it says PositionPerf is a %.

    PositionPerf is a ratio of Gain to Cost (which it does also says in the link).

    #233159

    Ha did you spot the typo … 50/40000 = 0.00125 (not 0.000125 as above).

    #233160

    Thanks. It’s for dax and cac. And if i prefer in pips ? 🙂

    #233162

    If you prefer pips then you can’t use PositionPerf.

    #233163

    You could use …

     

    1 user thanked author for this post.
    #233167
    JS

    Hi,

    Also keep in mind that your code will be read from top to bottom and the last “Set Stop pTrailing” will “override” all previous ones… The effect of your original code is the same as this code:

    If OnMarket then

    Set Stop pTrailing 20

    EndIf

    1 user thanked author for this post.
    #233178

    Positionprice * positionperf equals gain or loss in pips. So :

     

    1 user thanked author for this post.
Viewing 10 posts - 1 through 10 (of 10 total)

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