Daily candelstick heikin ashi

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #247675 quote
    ARLEQUIN49
    Participant
    Veteran

    Bonjour à tous,

    J’aurais besoin d’une modification de l’indicateur Daily Candelstick en heikin ashi. J’ai essayé mais mes compétences ne m’ont pas permis d’y parvenir.

    Voici le code de l’original qui faut passer en heikin ashi

    defparam drawonlastbaronly = true

    alpha = 500 //from 0 to 255 to change alpha transparency

    dop = dopen(0)
    dhi = dhigh(0)
    dlo = dlow(0)
    dcl = dclose(0)

    //candlestick color
    if dop>dcl then
    direction = -1
    else
    direction = 1
    endif

    //bullish candle
    if direction = 1 then
    //candlestick body
    DRAWRECTANGLE(barindex-5,dop,barindex,dcl) COLOURED(50,205,50,alpha)style(line,3)
    //candlestick high and low
    DRAWRECTANGLE(barindex-3,dcl,barindex-2,dhi) COLOURED(50,205,50,alpha)style(line,3)
    DRAWRECTANGLE(barindex-3,dop,barindex-2,dlo) COLOURED(50,205,50,alpha)style(line,3)
    endif

    //bearish candle
    if direction = -1 then
    //candlestick body
    DRAWRECTANGLE(barindex-5,dcl,barindex,dop) COLOURED(220,20,60,alpha)style(line,3)
    //candlestick high and low
    DRAWRECTANGLE(barindex-3,dop,barindex-2,dhi) COLOURED(220,20,60,alpha)style(line,3)
    DRAWRECTANGLE(barindex-3,dcl,barindex-2,dlo) COLOURED(220,20,60,alpha)style(line,3)
    endif

    RETURN

    #247699 quote
    robertogozzi
    Moderator
    Master

    Voilà, j’ai utilisé les mêmes noms que vos variables avec un X initial pour indiquer les bougies Heikin-Ashi :

    defparam drawonlastbaronly = true
    
    alpha = 500 //from 0 to 255 to change alpha transparency
    
    dop = dopen(0)
    dhi = dhigh(0)
    dlo = dlow(0)
    dcl = dclose(0)
    
    // Heikin - Ashi candlesticks
    once xDop = dop
    xDcl     = (dop + dcl + dhi + dlo) / 4
    if barindex > 0 then
    xDop  = (xDop + xDcl[1]) / 2
    endif
    xDlo       = min(dcl,min(xDcl,xDop))
    xDhi       = max(dhi,max(xDcl,xDop))
    
    //candlestick color
    if xdop>xdcl then
    direction = -1
    else
    direction = 1
    endif
    
    //bullish candle
    if direction = 1 then
    //candlestick body
    DRAWRECTANGLE(barindex-5,xdop,barindex,xdcl) COLOURED(50,205,50,alpha)style(line,3)
    //candlestick high and low
    DRAWRECTANGLE(barindex-3,xdcl,barindex-2,xdhi) COLOURED(50,205,50,alpha)style(line,3)
    DRAWRECTANGLE(barindex-3,xdop,barindex-2,xdlo) COLOURED(50,205,50,alpha)style(line,3)
    endif
    
    //bearish candle
    if direction = -1 then
    //candlestick body
    DRAWRECTANGLE(barindex-5,xdcl,barindex,xdop) COLOURED(220,20,60,alpha)style(line,3)
    //candlestick high and low
    DRAWRECTANGLE(barindex-3,xdop,barindex-2,xdhi) COLOURED(220,20,60,alpha)style(line,3)
    DRAWRECTANGLE(barindex-3,xdcl,barindex-2,xdlo) COLOURED(220,20,60,alpha)style(line,3)
    endif
    
    RETURN
    Iván González thanked this post
    #247710 quote
    ARLEQUIN49
    Participant
    Veteran

    un grand merci Roberto

    robertogozzi thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Daily candelstick heikin ashi


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
ARLEQUIN49 @arlequin49 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by ARLEQUIN49
8 months, 1 week ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/28/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...