Trailing stop tightening

Forums ProRealTime English forum ProOrder support Trailing stop tightening

  • This topic has 1 reply, 2 voices, and was last updated 2 weeks ago by avatarJS.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #231655

    Bien sûr, voici la traduction en anglais de votre demande :

    Hello,
    I am using the code below with a trailing stop of 30 points. If there is a favorable movement of 30 pips, the trailing stop moves to 25 pips, then to 20 pips, 10 pips, and 5 pips if the movement continues. Unfortunately, in live trading, after gaining 30 pips, the trailing stop correctly adjusts to 25 pips, but after a few movements, it goes back to 30 pips. I don’t understand what’s not working. Do you have any suggestions for modifications? Thank you.

    Here is the code:

    ///Variables pour le stop suiveur

    monPrixEntree = tradeprice
    monStopSuiveur = 30 // Valeur initiale du stop suiveur en pips
    IF NOT OnMarket THEN
    // Enregistrer le prix d’entrée à l’ouverture d’une position
    monPrixEntree = close
    ENDIF

    IF OnMarket THEN
    // Calculer la différence de prix en pips
    gainEnPips = (close – monPrixEntree) / pipSize

    // Ajuster le stop suiveur en fonction des gains
    IF gainEnPips >= 100 THEN
    monStopSuiveur = 5
    ELSIF gainEnPips >= 70 THEN
    monStopSuiveur = 10
    ELSIF gainEnPips >= 50 THEN
    monStopSuiveur = 20
    ELSIF gainEnPips > 30 THEN
    monStopSuiveur = 25

    ENDIF
    ENDIF
    // Appliquer le stop suiveur ajusté
    IF OnMarket THEN
    SET STOP pTRAILING monStopSuiveur
    ENDIF

    #231661
    JS

    Hi,

    Use Set Stop pLoss monStopSuiveur instead of Set Stop pTrailing monStopSuiveur

    For monPrixEntree“, use the TradePrice(1) instead of TradePrice

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

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