Weis Wave Volume

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #49351 quote
    bolsatrilera
    Participant
    Master

    Encontré este curioso indicador en la plataforma Tradingview creado por el gran Lazy Bear: https://es.tradingview.com/script/HFGx4ote-Indicator-Weis-Wave-Volume-LazyBear/

    Tengo esta adaptación para Prorealtime y me gustaría que alguién le echara un vistazo para corroborar si el código es correcto o contiene algún fallo…

    REM WEIS WAVE VOLUME
    // @author LazyBear
    // List of all indicators Lazy Bear: https://www.tradingview.com/v/4IneGo8h/
    //adaptación para Prorealtime por bolsatrilera
    //En cuadro de variables, showDistributionBelowZero=falso, tipo=boleano
    //En cuadro de variables, nz =falso,tipo=boleano
    
    trendDetectionLength=2
    
    if close>close[1] then
    mov=1
    elsif close<close[1] then
    mov=-1
    else
    mov=0
    endif
    
    if mov <>0 and mov <> mov[1] then
    trend=mov
    else
    trend=trend[nz]
    endif
    
    rising=abs(close-close[1])>abs(close-close[trendDetectionLength])
    falling=abs(close-close[1]<abs(close-close[trendDetectionLength]))
    
    if rising or falling then
    isTrending= rising or falling
    endif
    
    if trend <> wave[nz] and isTrending then
    wave=trend
    else
    wave=wave[nz]
    endif
    
    if wave=wave[1] then
    vol=vol[nz]+volume
    else
    vol=volume
    endif
    
    if wave=1 then
    up=vol
    else
    up=0
    endif
    
    if showDistributionBellowZero then
    if wave=1 then
    dn=0
    endif
    endif
    
    if wave=-1 then
    dn=-vol
    else
    dn=vol
    endif
    
    if wave=1 then
    dn=0
    else
    dn=vol
    endif
    
    
    
    return up coloured (0,128,0)style(histogram)as "up",dn coloured(255,0,0)style(histogram)as "dn"
    
    #49375 quote
    Nicolas
    Keymaster
    Master

    “nz” no es una variable en el lenguaje pinescript, es una instrucción para asegurar que una variable no sea igual a cero. Debería definirlo primero en su código antes de usar “nz” como variable.

    #49379 quote
    bolsatrilera
    Participant
    Master

    está definido Nicolas, se pone nz en el cuadro de variables y se elige tipo=boleano

    #49473 quote
    Nicolas
    Keymaster
    Master

    Oh ya veo, pero esa no es la forma en que debería haberlo codificado 🙂
    Puede eliminar y reemplazar todo su [nz] con [1] en este caso, para estar perfectamente de acuerdo con el código original.

    ¿Por qué no agregar esto también en nuestra biblioteca? ¡Otra buena adición! Gracias.

    #49605 quote
    bolsatrilera
    Participant
    Master

    lo que usted me dice es algo como esto ,¿ no es así Nicolas?

    REM WEIS WAVE VOLUME
    // @author LazyBear
    // List of all indicators Lazy Bear: https://www.tradingview.com/v/4IneGo8h/
    //adaptación para Prorealtime por bolsatrilera
    
    
    trendDetectionLength=2
    
    if close>close[1] then
    mov=1
    elsif close<close[1] then
    mov=-1
    else
    mov=0
    endif
    
    if mov <>0 and mov <> mov[1] then
    trend=mov
    else
    trend=trend[0]
    endif
    
    rising=abs(close-close[1])>abs(close-close[trendDetectionLength])
    falling=abs(close-close[1]<abs(close-close[trendDetectionLength]))
    
    if rising or falling then
    isTrending= rising or falling
    endif
    
    if trend <> wave[1] and isTrending then
    wave=trend
    else
    wave=wave[0]
    endif
    
    if wave=wave[1] then
    vol=vol[0]+volume
    else
    vol=volume
    endif
    
    if wave=1 then
    up=vol
    else
    up=0
    endif
    
    if 0 then
    if wave=1 then
    dn=0
    endif
    endif
    
    if wave=-1 then
    dn=-vol
    else
    dn=vol
    endif
    
    if wave=1 then
    dn=0
    else
    dn=vol
    endif
    
    
    
    return up coloured (0,128,0)style(histogram)as "up",dn coloured(255,0,0)style(histogram)as "dn"
    
    Nicolas thanked this post
    #49660 quote
    Nicolas
    Keymaster
    Master
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Weis Wave Volume


ProBuilder: Indicadores y Herramientas

New Reply
Author
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Nicolas
8 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 10/14/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...