new indicator: ALMA TREND DETECTOR

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

    Hello all,

    I tried to code a trend indicator based on ALMA indicator…so far so good.

    BUT, my coding skills are basic and I couldn`t code the “coloring” of the bars.

    Please could anyone help finalizing this code and adding correct colouring to bars?

    Thank you all very much in advance.

    Regards,

    Micha

    {// ALMA Trend Detector Indicator für ProRealTime

    DEFPARAM CalculateOnLastBars = 1200

    // Eingaben
    inputLength = 48 // Arnaud Legoux MA Länge
    inputOffset = 0.15 // ALMA Offset
    inputSigma = 6 // ALMA Sigma Wert

    // ALMA
    m = (inputOffset * (inputLength – 1))
    s = inputLength / inputSigma

    WtdSum = 0
    CumWt = 0

    FOR k = 0 TO inputLength – 1 DO
    Wtd = EXP(-((k – m) * (k – m)) / (2 * s * s))
    WtdSum = WtdSum + Wtd * Close[inputLength – 1 – k]
    CumWt = CumWt + Wtd
    NEXT

    trendALMA = WtdSum / CumWt

    // Farben
    IF trendALMA >= trendALMA[1] THEN
    r1 = 0
    g1 = 255
    b1 = 255 // Aqua
    ELSE
    r1 = 255
    g1 = 0
    b1 = 255 // Fuchsia
    ENDIF

    IF Low < trendALMA THEN
    r12 = 255
    g12 = 0
    b12 = 0 // Rot
    ELSE
    r12 = 0
    g12 = 255
    b12 = 0 // Grün
    ENDIF

    // Zeichnen der ALMA-Linie
    FOR i = 1 TO BarNumber DO
    DRAWSEGMENT(i-1, trendALMA[i-1], i, trendALMA[i], RGB(r1, g1, b1), 2)
    NEXT

    // Balkenfarben
    BACKGROUNDCOLOR(Low < trendALMA, RGB(r12, g12, b12)) // Rot für Balken unter ALMA //???????
    BACKGROUNDCOLOR(Low >= trendALMA, RGB(0, 255, 0)) // Grün für Balken über ALMA // ????????

    RETURN trendALMA}

    #244012 quote
    JS
    Participant
    Senior

    This is with the coloring of the candles…

    DEFPARAM CalculateOnLastBars = 1200
    
    // Eingaben
    inputLength = 48 // Arnaud Legoux MA Länge
    inputOffset = 0.15 // ALMA Offset
    inputSigma = 6 // ALMA Sigma Wert
    
    // ALMA
    m = (inputOffset * (inputLength - 1))
    s = inputLength / inputSigma
    
    WtdSum = 0
    CumWt = 0
    
    FOR k = 0 TO inputLength - 1 DO
    Wtd = EXP(-((k - m) * (k - m)) / (2 * s * s))
    WtdSum = WtdSum + Wtd * Close[inputLength - 1 - k]
    CumWt = CumWt + Wtd
    NEXT
    
    trendALMA = WtdSum / CumWt
    
    If Close>TrendAlma then
    R=0
    G=255
    B=0
    Else
    R=255
    G=0
    B=0
    EndIf
    
    DrawCandle(Open,High,Low,Close)Coloured(R,G,B)
    
    Return TrendAlma
    #244097 quote
    micha2012
    Participant
    Average

    @JS

    Hello JS,

    thank you very, very much for your support and help.

    Now, the indicator is completely runnig!

    Bedankt, mein Freund!

    CU all.

    Thank you.

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

new indicator: ALMA TREND DETECTOR


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
micha2012 @micha2012 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by micha2012
11 months, 3 weeks ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/18/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...