Stratégie pattern de retournement

Forums ProRealTime forum Français Support ProOrder Stratégie pattern de retournement

  • This topic has 9 replies, 3 voices, and was last updated 1 day ago by avatarGraHal.
Viewing 10 posts - 1 through 10 (of 10 total)
  • #250344

    Bonjours

    J’ai codé la stratégie, mai vue que c la première je pense avoir oublié des trucs, et si possible de backtest la stratégie pour voir si elle et rentable sur le long terme, vous pouvez apporter des modifications.

    Sur le Dax en 1 min.

    #250349

    Votre code est impossible à voir car si petit, mais il n’est pas non plus convivial dans un .jpg.

    Postez votre code par copier-coller en utilisant le bouton bleu – Insérer le code PRT – sur la flèche verte ci-jointe et je le testerai sur ma plateforme pour vous.

     

    #250351

    // ============================
    // STRATÉGIE PATTERN RETOURNEMENT DAX
    // ============================

    DEFPARAM CumulateOrders = False
    DEFPARAM PreLoadBars = 500

    // — Heikin Ashi —
    haClose = (open + high + low + close) / 4
    haOpen = (haOpen[1] + haClose[1]) / 2
    haHigh = max(high, haOpen, haClose)
    haLow = min(low, haOpen, haClose)

    // — Détection du pattern —
    // Impulsion
    impulseUp = haClose > haOpen AND haClose > haHigh[1]
    impulseDown = haClose < haOpen AND haClose < haLow[1] // Hésitation hesitation = (haHigh - haClose > 1 AND haClose – haLow > 1)

    // Validation du retournement
    reversalUp = impulseDown[1] AND hesitation AND haClose > haHigh[1]
    reversalDown = impulseUp[1] AND hesitation AND haClose < haLow[1] // ============================ // FILTRE JOUR & HEURE // ============================ isTradingDay = dayofweek >= 1 AND dayofweek <= 5 isTradingHour = time >= 083000 AND time < 200000 // ============================ // CONDITIONS D’ENTRÉE // ============================ // Entrée en long IF isTradingDay AND isTradingHour AND reversalUp THEN BUY 1 CONTRACT AT MARKET stopLevel = lowest[5](low) // stop initial SET STOP pLOSS (close - stopLevel) * pipsize ENDIF // Entrée en short IF isTradingDay AND isTradingHour AND reversalDown THEN SELLSHORT 1 CONTRACT AT MARKET stopLevel = highest[5](high) SET STOP pLOSS (stopLevel - close) * pipsize ENDIF // ============================ // STOP SUIVEUR DYNAMIQUE // ============================ IF longonmarket THEN profitPoints = close - tradeprice(1) // Activation du stop suiveur à +8 points IF profitPoints >= 8 THEN
    newStop = tradeprice(1) + 2 // +2 points au-dessus du prix d’entrée
    step = FLOOR((profitPoints – 8) / 4)
    newStop = MAX(newStop, tradeprice(1) + step * 4 + 2)
    SET STOP ploss (tradeprice(1) – newStop) * pipsize
    ENDIF
    ENDIF

    IF shortonmarket THEN
    profitPoints = tradeprice(1) – close

    IF profitPoints >= 8 THEN
    newStop = tradeprice(1) – 2 // -2 points sous le prix d’entrée
    step = FLOOR((profitPoints – 8) / 4)
    newStop = MIN(newStop, tradeprice(1) – step * 4 – 2)
    SET STOP ploss (newStop – tradeprice(1)) * pipsize
    ENDIF
    ENDIF

    // ============================
    // CLÔTURE FORCÉE À 20h00
    // ============================
    IF time >= 200000 THEN
    IF longonmarket THEN
    SELL AT MARKET
    ENDIF
    IF shortonmarket THEN
    EXITSHORT AT MARKET
    ENDIF
    ENDIF

    #250353

     

    1 user thanked author for this post.
    #250358

    La définition correcte des bougies HA est la suivante :

     

    1 user thanked author for this post.
    #250359

    La version ci-jointe (j’ai corrigé l’erreur dans le code ci-dessus) prend les transactions sur DAX M2.

    #250363

    Ok merci les modifications, avait vous pu backtest la stratégie.

    #250365

    Oui, voulez-vous voir les résultats du backtest ?

    Ne pouvez-vous pas backtester le fichier .itf que j’ai posté ci-dessus ? 

    #250366

    Le problème j’ai pas encore accès prorealtime, et oui je veux bien les résultats si ça vous dérange pas.

    Merci.

    #250371

    Voir ci-joint. Je n’ai pas réussi à le rendre aussi parfait que possible. 

    Votre code publié n’ouvrirait pas de transactions ; il y avait plusieurs erreurs, j’ai trié ces erreurs et le résultat est joint.

    Si vous voulez voir les modifications que j’ai apportées, entrez votre code et mon code (dans le fichier .itf) dans ce « diffchecker ».  

    https://www.diffchecker.com/

     

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