Indicateur BLSH : colorier les bougies signal vert/rouge

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #258401 quote
    geroniman
    Participant
    Average

    L indicateur BLSH est vraiment excellent. Pour plus de visibilité, est il possible de colorier sur le graphique la bougie signal “point vert” en vert et point rouge” en rouge quand la boule apparait? ( les bougies de base sont en blanc/noir) Merci.



    //—————————————-

    //PRC_Buy Low Sell High Composite (BLSH)

    //version = 0

    //23.01.2026

    //Iván González @ http://www.prorealcode.com

    //Sharing ProRealTime knowledge

    //—————————————-

    // Parameters

    //—————————————-

    atrLen = 9

    rsiLen = 14

    mfiLen = 14

    //—————————————-

    // 1. Base Calculations

    //—————————————-

    atrValue = AverageTrueRange[atrLen](close)

    priceRange = 2 * atrValue

    minRangeDiv = 0.0001 // Safe range to avoid division by zero

    //—————————————-

    // 2. RSI Calculation

    //—————————————-

    rsiVal = RSI[rsiLen](close)

    rsiRange = 75 – 25

    rsiValueNormalized = -1 + (((rsiVal – 25) / rsiRange) * 2)

    //—————————————-

    // 3. Elliott Wave (EMA Difference)

    //—————————————-

    emaDiff = ExponentialAverage[5](close) – ExponentialAverage[35](close)

    ewRange = (priceRange – (-priceRange))

    IF ewRange = 0 THEN

      ewRange = minRangeDiv

    ENDIF

    emaDiffNormalized = -1 + (((emaDiff – (-priceRange)) / ewRange) * 2)

    //—————————————-

    // 4. MACD Calculation

    //—————————————-

    fastMA = ExponentialAverage[12](close)

    slowMA = ExponentialAverage[26](close)

    macdVal = fastMA – slowMA

    imacdSignal = Average[9](macdVal)

    macdHistogram = macdVal – imacdSignal

    // MACD Normalization

    macdRange = priceRange – (-priceRange)

    IF macdRange = 0 THEN

      macdRange = minRangeDiv

    ENDIF

    macdNormalized = -1 + (((macdVal – (-priceRange)) / macdRange) * 2)

    macdSignalNormalized = -1 + (((imacdSignal – (-priceRange)) / macdRange) * 2)

    macdHistogramNormalized = -1 + (((macdHistogram – (-priceRange)) / macdRange) * 2)

    //—————————————-

    // 5. MFI Calculation

    //—————————————-

    typicalP = TypicalPrice

    posFlow = 0

    negFlow = 0


    FOR i = 0 TO mfiLen – 1 DO

      IF typicalP[i] > typicalP[i+1] THEN

       posFlow = posFlow + (volume[i] * typicalP[i])

      ELSIF typicalP[i] < typicalP[i+1] THEN

       negFlow = negFlow + (volume[i] * typicalP[i])

      ENDIF

    NEXT


    IF negFlow = 0 THEN

      mfiVal = 100

    ELSE

      mfiVal = 100 – (100 / (1 + (posFlow / negFlow)))

    ENDIF


    mfiRange = 75 – 25

    mfiValueNormalized = -1 + (((mfiVal – 25) / mfiRange) * 2)

    //—————————————-

    // 6. Composite Logic

    //—————————————-

    compositeValue = emaDiffNormalized + rsiValueNormalized + macdHistogramNormalized + mfiValueNormalized

    // Final normalization between -4 and 4

    compRange = 4 – (-4)

    compositeNormalized = -1 + (((compositeValue – (-4)) / compRange) * 2)

    //—————————————-

    // 7. Colors and Styles

    //—————————————-

    // Composite Color (Lime if > 0, Red if <= 0)

    IF compositeValue > 0 THEN

      compR = 0

      compG = 255

      compB = 0

    ELSE

      compR = 255

      compG = 0

      compB = 0

    ENDIF

    // Crossover Logic for MACD Signal Color

    IF macdVal >= imacdSignal THEN

      crossR = 0

      crossG = 255

      crossB = 0

    ELSE

      crossR = 255

      crossG = 0

      crossB = 0

    ENDIF

    // Crossover Dot

    crossoverValue = Undefined

    IF macdVal CROSSES OVER imacdSignal OR macdVal CROSSES UNDER imacdSignal THEN

      crossoverValue = macdSignalNormalized

      drawpoint(barindex,crossoverValue,2)COLOURED(crossR, crossG, crossB)

    ENDIF


    colorbetween(compositeNormalized,0,compR, compG, compB,90)

    //—————————————-

    RETURN compositeNormalized COLOURED(compR, compG, compB) AS “Composite”, macdSignalNormalized COLOURED(crossR, crossG, crossB) AS “MACD SignalNormalized”

    .

    #258412 quote
    Iván González
    Moderator
    Master

    Bonjour. Créez un nouvel indicateur et copiez le code ci-dessus.

    Il vous suffit de modifier la ligne 107 et, au lieu de dessiner un point, de colorier la barre.

       drawcandle(open,high,low,close)COLOURED(crossR, crossG, crossB)
    

    Enfin, supprimez la ligne 110 (« colorbetween…. »), et sur la dernière ligne, appuyez sur RETURN, puis supprimez les variables. Terminez simplement par RETURN.



    #258420 quote
    geroniman
    Participant
    Average

    PARFAIT MERCI iVAN

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

Indicateur BLSH : colorier les bougies signal vert/rouge


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
geroniman @geroniman Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by geroniman
4 days, 15 hours ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/22/2026
Status: Active
Attachments: No files
Logo Logo
Loading...