Traduzione indicatore EMA Wave and GRaB Candles by JustUncleL

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #253134 quote
    Msport71
    Participant
    Junior

    Buongiorno,

     

    sono a chiedere cortese traduzione codice in oggetto, che trovo interessante.

     

    Grazie

    https://www.tradingview.com/script/OeeX5b5L-EMA-Wave-and-GRaB-Candles-by-JustUncleL/

    //@version=3
    //
    study(“EMA Wave and GRaB Candles by JustUncleL”, overlay=true,shorttitle=”WAVEGRAB”)

    //
    // Author: JustUncleL
    // Date :24-March-2017
    //
    // Description:
    // This is a specialised Price Action Channel (PAC) or Wave that mirrors the indicator used by
    // Raghee Horner, the “34EMA Wave and GRaB Candles”.
    //
    // The Wave consist of
    // – 34 period exponential moving average on the high
    // – 34 period exponential moving average on the close
    // – 34 period exponential moving average on the low
    //
    // The GRaB candles colour scheme:
    // – Lime = Bull candle closed above Wave
    // – Green = Bear candle closed above Wave
    // – Red = Bull candle closed below Wave
    // – DarkRed = Bear candle closed below Wave
    // – Aqua = Bull candle closed inside Wave
    // – Blue = Bear candle closed inside Wave
    //
    // Optionally display a trend direction indication along bottom of chart.
    //
    // Reference:
    // For some details on how Raghee uses this indicator check out
    // – https://www.forexfactory.com/showthread.php?t=492080
    // and her various training and webinar videos on Youtube
    //
    // Note: This code is licensed under open source GPLv3 terms and conditions. Any
    // modifications to it should be made public and linked to the original code.
    //

    //
    // === INPUTS ===
    //
    ShowPAC = input(true, title=”Show EMA Wave”)
    ShowBarColor = input(true, title=”Show Coloured GRaB Candles”)
    ShowTrendIndi = input(false, title=”Show Trend Indicator”)
    PACLen = input(34,minval=2,title=”EMA Wave Length (34 by default)”)
    src = input(close,title=”Source for Wave centre EMA”)

    // — CONSTANTS —
    DodgerBlue = #1E90FF

    // === /INPUTS ===
    // Constants colours that include fully non-transparent option.
    green100 = #008000FF
    lime100 = #00FF00FF
    red100 = #FF0000FF
    blue100 = #0000FFFF
    aqua100 = #00FFFFFF
    darkred100 = #8B0000FF

    // === SERIES SETUP ===

    // Price action channel (Wave)
    pacCe = ema(src, PACLen)
    pacLo = ema(low, PACLen)
    pacHi = ema(high, PACLen)

    // === /SERIES ===

    // === PLOTTING ===
    //
    // If selected, Plot the Wave Channel based on EMA high,low and close
    L=plot(ShowPAC ?pacLo:na, color=red, linewidth=1, title=”High Wave EMA”,transp=20)
    H=plot(ShowPAC ?pacHi:na, color=green, linewidth=1, title=”Low Wave EMA”,transp=20)
    C=plot(ShowPAC ?pacCe:na, color=black, linewidth=1, title=”Centre Wave EMA”,transp=20)
    fill(L,H, color=gray,transp=92,title=”Fill Channel”)

    // Colour bars according to the close position relative to the PAC selected.
    bColour = close>=open? close>=pacHi? lime100 : close<=pacLo? red100 : aqua100 : close>=pacHi? green100 : close<=pacLo? darkred100 : blue100
    barcolor(ShowBarColor?bColour:na, title = “Bar Colours”)

    // Show trend direction indication on the bottom
    wcolor = high>pacHi and low>pacHi? lime : low<pacLo and high<pacLo ? red : gray
    plotshape(ShowTrendIndi?src:na, color=wcolor,location=location.bottom,style=shape.square,size=size.small,transp=20,title=”Trend Direction”)

    // === /PLOTTING ===
    // eof

    #253143 quote
    Iván González
    Moderator
    Master

    Ecco:

    // ------------------------------------------
    //PRC_EMA Wave and GRaB
    //version = 0
    //30.10.2025
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    // ------------------------------------------
    // --- VARIABLES DE USUARIO ---
    // ------------------------------------------
    // (1 = Mostrar, 0 = Ocultar)
    ShowPAC = 1 // Mostrar la "Wave" (las 3 líneas EMA)
    ShowBarColor = 1 // Mostrar las velas coloreadas GRaB
    ShowTrendIndi = 1 // Mostrar indicador de tendencia
    PACLen = 34 // Longitud de la EMA (34 por defecto)
    // ------------------------------------------
    // --- CÁLCULO DE LA WAVE (PAC) ---
    // ------------------------------------------
    pacCe = exponentialaverage[PACLen](close)
    pacLo = exponentialaverage[PACLen](low)
    pacHi = exponentialaverage[PACLen](high)
    // ------------------------------------------
    // --- LÓGICA DE COLOR DE VELAS (GRaB) ---
    // ------------------------------------------
    // Definimos los componentes RGB para cada color
    colorR = 0
    colorG = 0
    colorB = 0
    
    IF close >= open THEN // Vela Alcista
    IF close >= pacHi THEN // Lime (Verde Lima)
    colorR = 0
    colorG = 255
    colorB = 0
    ELSIF close <= pacLo THEN // Red (Rojo)
    colorR = 255
    colorG = 0
    colorB = 0
    ELSE // Aqua (Dentro de la Wave)
    colorR = 0
    colorG = 255
    colorB = 255
    ENDIF
    ELSE // Vela Bajista
    IF close >= pacHi THEN // Green (Verde Oscuro)
    colorR = 0
    colorG = 128
    colorB = 0
    ELSIF close <= pacLo THEN // DarkRed (Rojo Oscuro)
    colorR = 139
    colorG = 0
    colorB = 0
    ELSE // Blue (Azul)
    colorR = 0
    colorG = 0
    colorB = 255
    ENDIF
    ENDIF
    // ------------------------------------------
    // --- LÓGICA DEL INDICADOR DE TENDENCIA ---
    // ------------------------------------------
    // 1 = Fuerte Alcista (Lime)
    // -1 = Fuerte Bajista (Red)
    // 0 = Neutral (Gray)
    
    trendValue = 0 // Gris por defecto
    IF high > pacHi AND low > pacHi THEN
    trendValue = 1 // Lime
    ELSIF low < pacLo AND high < pacLo THEN
    trendValue = -1 // Red
    ENDIF
    
    // Asignar colores
    colortrendR = 128 // Gris por defecto
    colortrendG = 128
    colortrendB = 128
    
    IF trendValue = 1 THEN // Lime
    colortrendR = 0
    colortrendG = 255
    colortrendB = 0
    ELSIF trendValue = -1 THEN // Red
    colortrendR = 255
    colortrendG = 0
    colortrendB = 0
    ENDIF
    // ------------------------------------------
    // --- DIBUJO DE VELAS ---
    // ------------------------------------------
    // Si está activado, dibujamos las velas con el color calculado
    IF ShowBarColor THEN
    DRAWCANDLE(open, high, low, close) COLOURED(colorR, colorG, colorB)
    ENDIF
    // ------------------------------------------
    // --- PLOTEO DE LÍNEAS (WAVE) ---
    // ------------------------------------------
    // Si ShowPAC es 0, devolvemos 'undefined' para ocultar las líneas
    plotPacHi = undefined
    plotPacLo = undefined
    plotPacCe = undefined
    
    IF ShowPAC THEN
    plotPacHi = pacHi
    plotPacLo = pacLo
    plotPacCe = pacCe
    colorbetween(plotPacHi,plotPacLo,"grey",50)
    ENDIF
    // ------------------------------------------
    // --- PLOTEO Indicador Tendencia---
    // ------------------------------------------
    // Devolvemos el valor solo si ShowTrendIndi es 1
    plotValue = undefined
    IF ShowTrendIndi THEN
    plotValue = trendValue
    drawrectangle(barindex,10,barindex+1,20)coloured(colortrendR,colortrendG,colortrendB)fillcolor(colortrendR,colortrendG,colortrendB,90)anchor(bottom,index,yshift)
    ENDIF
    // --------------------------------------
    RETURN plotPacHi AS "High Wave"coloured("green"), plotPacCe AS "Centre Wave"coloured("darkblue"), plotPacLo AS "Low Wave"coloured("red")
    
    Msport71 thanked this post
    #253144 quote
    Msport71
    Participant
    Junior

    Perfetto, grazie !!!

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

Traduzione indicatore EMA Wave and GRaB Candles by JustUncleL


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Msport71 @carlo-pasca Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 10/30/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...