Bougie heinkin ashi +

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #215911 quote
    FXtonioFXtonio
    Participant
    Average

    Bonjour,

    ci dessous un code heikin ashi, j’aimerais en faire un algo de la façon suivante,

    si 3 bougies HA verte cloture, prendre un achat a la prochaine (sortir à la 1ere HA rouge)

    si 3 bougies HA rouge cloture, prendre une vente a la prochaine (sortir à la 1ere Ha verte)

    je rajouterais ensuite les filtres de tendances et volatilité et posterais le tout une fois fini.

    Merci pour votre aide 🙂 🙂

    //Bougies Heikin Ashi
    // Ozmizrak 19/11/2020
    HeikinAshiClose = (Open+High+Low+Close)/4
    IF BarIndex > 1 * 2 Then //* 2 Par Sécurité
    HeikinAshiOpen = (HeikinAshiOpen[1] + HeikinAshiClose[1])/2
    //HeikinAshiHigh = valeur la plus haute des trois : H, OHA, CHA
    If High > HeikinAshiOpen Then
    HeikinAshiHigh = High
    Else
    HeikinAshiHigh = HeikinAshiOpen
    EndIf
    if HeikinAshiClose > HeikinAshiHigh Then
    HeikinAshiHigh = HeikinAshiClose
    EndIf
    //HeikinAshiLow = valeur la plus basse des trois : B, OHA, CHA
    If Low < HeikinAshiOpen Then
    HeikinAshiLow = Low
    Else
    HeikinAshiLow = HeikinAshiOpen
    EndIf
    if HeikinAshiClose < HeikinAshiLow Then
    HeikinAshiLow = HeikinAshiClose
    EndIf
    Else
    HeikinAshiOpen = Open
    HeikinAshiHigh = High
    HeikinAshiLow = Low
    EndIf
    If HeikinAshiClose > HeikinAshiOpen Then
    DrawCandle (HeikinAshiOpen[0], HeikinAshiHigh[0], HeikinAshiLow[0], HeikinAshiClose[0]) COLOURED (0,255,255)
    ElsIf HeikinAshiClose < HeikinAshiOpen Then
    DrawCandle (HeikinAshiOpen[0], HeikinAshiHigh[0], HeikinAshiLow[0], HeikinAshiClose[0]) COLOURED (255,85,85)
    Else
    DrawCandle (HeikinAshiOpen[0], HeikinAshiHigh[0], HeikinAshiLow[0], HeikinAshiClose[0]) COLOURED (0, 0, 0)
    EndIf
    //Bougies Heikin Ashi
    // Ozmizrak 19/11/2020
    HeikinAshiClose = (Open+High+Low+Close)/4
    IF BarIndex > 1 * 2 Then //* 2 Par Sécurité
    HeikinAshiOpen = (HeikinAshiOpen[1] + HeikinAshiClose[1])/2
    //HeikinAshiHigh = valeur la plus haute des trois : H, OHA, CHA
    If High > HeikinAshiOpen Then
    HeikinAshiHigh = High
    Else
    HeikinAshiHigh = HeikinAshiOpen
    EndIf
    if HeikinAshiClose > HeikinAshiHigh Then
    HeikinAshiHigh = HeikinAshiClose
    EndIf
    //HeikinAshiLow = valeur la plus basse des trois : B, OHA, CHA
    If Low < HeikinAshiOpen Then
    HeikinAshiLow = Low
    Else
    HeikinAshiLow = HeikinAshiOpen
    EndIf
    if HeikinAshiClose < HeikinAshiLow Then
    HeikinAshiLow = HeikinAshiClose
    EndIf
    Else
    HeikinAshiOpen = Open
    HeikinAshiHigh = High
    HeikinAshiLow = Low
    EndIf
    If HeikinAshiClose > HeikinAshiOpen Then
    DrawCandle (HeikinAshiOpen[0], HeikinAshiHigh[0], HeikinAshiLow[0], HeikinAshiClose[0]) COLOURED (0,255,255)
    ElsIf HeikinAshiClose < HeikinAshiOpen Then
    DrawCandle (HeikinAshiOpen[0], HeikinAshiHigh[0], HeikinAshiLow[0], HeikinAshiClose[0]) COLOURED (255,85,85)
    Else
    DrawCandle (HeikinAshiOpen[0], HeikinAshiHigh[0], HeikinAshiLow[0], HeikinAshiClose[0]) COLOURED (0, 0, 0)
    EndIf
    Return
    
    #260530 quote
    NicolasNicolas
    Keymaster
    Legend

    Voici le système complet :

    DEFPARAM CumulateOrders = False
    
    
    // ---- Calcul Heikin Ashi ----
    HAClose = (Open + High + Low + Close) / 4
    
    
    IF BarIndex > 2 THEN
      HAOpen = (HAOpen[1] + HAClose[1]) / 2
      IF High > HAOpen THEN
        HAHigh = High
      ELSE
        HAHigh = HAOpen
      ENDIF
      IF HAClose > HAHigh THEN
        HAHigh = HAClose
      ENDIF
      IF Low < HAOpen THEN
        HALow = Low
      ELSE
        HALow = HAOpen
      ENDIF
      IF HAClose < HALow THEN
        HALow = HAClose
      ENDIF
    ELSE
      HAOpen = Open
      HAHigh = High
      HALow  = Low
    ENDIF
    
    
    // ---- Couleur des bougies HA ----
    HAGreen = (HAClose > HAOpen)
    HARed   = (HAClose < HAOpen)
    
    
    // ---- Conditions : 3 bougies consécutives de la même couleur ----
    Signal3Green = HAGreen AND HAGreen[1] AND HAGreen[2]
    Signal3Red   = HARed   AND HARed[1]   AND HARed[2]
    
    
    // ---- Entrées (à la bougie suivante au marché) ----
    IF NOT LongOnMarket AND Signal3Green THEN
      BUY 1 CONTRACT AT MARKET
    ENDIF
    
    
    IF NOT ShortOnMarket AND Signal3Red THEN
      SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    
    // ---- Sorties (1ère bougie de couleur opposée) ----
    IF LongOnMarket AND HARed THEN
      SELL 1 CONTRACT AT MARKET
    ENDIF
    
    
    IF ShortOnMarket AND HAGreen THEN
      EXITSHORT 1 CONTRACT AT MARKET
    ENDIF
    


Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Bougie heinkin ashi +


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
FXtonio @fxtonio Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
6 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/09/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...