Bull & Bear Volume-by-Price levels – modo VPOC

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #85582 quote
    oracle
    Participant
    Junior

    Agregar una línea en el indicador Bull & Bear Volume-by-Price levels , indicado el Volumen Máximo .. en modo VPOC”.

    Bull & Bear Volume-by-Price levels

    #85704 quote
    Nicolas
    Keymaster
    Master

    Aquí está el código que identifica y traza el VPOC en la tabla de precios:

    //PRC_Bull&Bear Volume on Price | indicator
    //05.07.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    defparam drawonlastbaronly=true
    defparam calculateonlastbars=1000
    
    // --- settings
    ScaleFactor = 3
    NbrBars=10
    lookback=150
    // --- end of settings
    
    hh=highest[lookback](high)
    ll=lowest[lookback](low)
    div = (hh-ll)/NbrBars
    i=0
    volsum=summation[lookback](volume)
    startbar = barindex[lookback]
    maxbar = 0
    while i<NbrBars do
    lrange=ll+div*i
    hrange=lrange+div
    volbull=0
    volbear=0
    for j = 1 to lookback do
    if close[j]>=lrange and close[j]<=hrange then
    if close[j]>open[j] then
    volbull=volbull+volume[j]
    else
    volbear=volbear+volume[j]
    endif
    endif
    next
    bullbar = round((volbull*lookback)/volsum)*scalefactor
    bearbar = round((volbear*lookback)/volsum)*scalefactor
    
    drawrectangle(startbar,lrange,startbar+bullbar,hrange) coloured(46,139,87)
    drawrectangle(startbar,lrange,startbar+bearbar,hrange) coloured(255,0,0)
    
    if bullbar>bearbar then
    drawtext("■",startbar+bullbar,(lrange+hrange)/2,Dialog,Bold,22) coloured(46,139,87)
    else
    drawtext("■",startbar+bearbar,(lrange+hrange)/2,Dialog,Bold,22) coloured(255,0,0)
    endif
    
    //VPOC
    if(bullbar>maxbar) then 
    vpocbar=startbar+bullbar
    vpoclevel = (lrange+hrange)/2
    maxbar=bullbar
    endif
    if(bearbar>maxbar) then 
    vpocbar=startbar+bearbar
    vpoclevel = (lrange+hrange)/2
    maxbar=bearbar
    endif
    
    i=i+1
    wend
    drawvline(barindex[lookback])
    drawsegment(vpocbar,vpoclevel,barindex,vpoclevel)
    
    return
    oracle thanked this post
    #85712 quote
    oracle
    Participant
    Junior

    Gracias Nicolas. Eres un tio genial..

    #87005 quote
    oracle
    Participant
    Junior

    Hola Nicolas de nuevo…

    Podría añadir otra modificación. ahora detectar el volumen mas bajo en el indicador Bull & Bear Volume-by-Price levels.

    Como se muestra en la imagen.

    Gracias por adelantado por tu gran trabajo y aportaciones en Prorealcode.

    #87275 quote
    Nicolas
    Keymaster
    Master

    Éste agrega el área de volúmenes mínimos con una línea roja, como la forma que desee.

    //PRC_Bull&Bear Volume on Price | indicator
    //05.07.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    defparam drawonlastbaronly=true
    defparam calculateonlastbars=1000
    
    // --- settings
    ScaleFactor = 3
    NbrBars=10
    lookback=150
    // --- end of settings
    
    hh=highest[lookback](high)
    ll=lowest[lookback](low)
    div = (hh-ll)/NbrBars
    i=0
    volsum=summation[lookback](volume)
    startbar = barindex[lookback]
    maxbar = 0
    while i<NbrBars do
    lrange=ll+div*i
    hrange=lrange+div
    volbull=0
    volbear=0
    for j = 1 to lookback do
    if close[j]>=lrange and close[j]<=hrange then
    if close[j]>open[j] then
    volbull=volbull+volume[j]
    else
    volbear=volbear+volume[j]
    endif
    endif
    next
    bullbar = round((volbull*lookback)/volsum)*scalefactor
    bearbar = round((volbear*lookback)/volsum)*scalefactor
    
    drawrectangle(startbar,lrange,startbar+bullbar,hrange) coloured(46,139,87)
    drawrectangle(startbar,lrange,startbar+bearbar,hrange) coloured(255,0,0)
    
    if bullbar>bearbar then
    drawtext("■",startbar+bullbar,(lrange+hrange)/2,Dialog,Bold,22) coloured(46,139,87)
    else
    drawtext("■",startbar+bearbar,(lrange+hrange)/2,Dialog,Bold,22) coloured(255,0,0)
    endif
    
    //VPOC
    if(bullbar>maxbar) then
    vpocbar=startbar+bullbar
    vpoclevel = (lrange+hrange)/2
    maxbar=bullbar
    endif
    if(bearbar>maxbar) then
    vpocbar=startbar+bearbar
    vpoclevel = (lrange+hrange)/2
    maxbar=bearbar
    endif
    
    //minBAR
    if i = 0 then 
    minbar=min(bullbar,bearbar)
    else
    if(bullbar<minbar) then
    vpocbarmin=startbar+bullbar
    vpoclevelmin = (lrange+hrange)/2
    minbar=bullbar
    endif
    if(bearbar<minbar) then
    vpocbarmin=startbar+bearbar
    vpoclevelmin = (lrange+hrange)/2
    minbar=bearbar
    endif
    endif
    
    
    i=i+1
    wend
    drawvline(barindex[lookback])
    drawsegment(vpocbar,vpoclevel,barindex,vpoclevel)
    drawsegment(vpocbarmin,vpoclevelmin,barindex,vpoclevelmin) coloured(255,0,0)
    
    return
    #92361 quote
    dcastellop
    Participant
    Senior

    Buenas tardes,  primero agradecer el trabajo que hacéis entre todos con prorealcode.

    Quería preguntar si sería posible ver en el indicador Bull & Bear Volume-by-Price levels el vpoc del día anterior de manera opcional?, solo el tramo del día anterior como opción lookback=[DOpen(1) DClose(1)], gracias de antemano.

    Saludos.

    #92364 quote
    Nicolas
    Keymaster
    Master

    Este indicador no utiliza un período diario, sino un período en cantidad de barras (el valor predeterminado es 1000). Entonces, lo que está preguntando no está relacionado con la funcionalidad de este indicador.

    #92381 quote
    dcastellop
    Participant
    Senior

    Gracias por responder, hay algún indicador que muestre el vpoc del día anterior?

    saludos.

    #92480 quote
    dcastellop
    Participant
    Senior

    He hecho algún cambio en el código para mostrar el vpoc del día anterior por si a alguien le sirve lo pongo aquí:

    //PRC_Bull&Bear Volume on Price | indicator
    //05.07.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    //Modificado 27/2/218
    
    defparam calculateonlastbars=2000
     
    // --- settings
    ScaleFactor=3
    NbrBars=10
    lookback=max(1, intradaybarindex)
    // --- end of settings
    
    hh=highest[lookback](high)
    ll=lowest[lookback](low)
    div = (hh-ll)/NbrBars
    i=0
    volsum=summation[lookback](volume)
    
    maxbar = 0
    while i<NbrBars do
      lrange=ll+div*i
      hrange=lrange+div
      volbull=0
      volbear=0
      for j = 1 to lookback do
         if close[j]>=lrange and close[j]<=hrange then
            if close[j]>open[j] then
               volbull=volbull+volume[j]
            else
               volbear=volbear+volume[j]
            endif
         endif
      next
      bullbar = round((volbull*lookback)/volsum)*scalefactor
      bearbar = round((volbear*lookback)/volsum)*scalefactor
     
     //VPOC
      if(bullbar>maxbar) then
      vpoclevel = (lrange+hrange)/2
      maxbar=bullbar
      endif
      if(bearbar>maxbar) then
        vpoclevel = (lrange+hrange)/2
        maxbar=bearbar
      endif
      
    i=i+1
    wend
    
    if intradaybarindex=1 then
    yesterdayVPOC=vpoclevel[2]
    drawtext("                                                                                                                                                ---------------------------- yesterday VPOC [#yesterdayVPOC#]----------------------------------------------",barindex[2],vpoclevel[2],dialog,bold,15) coloured(0,0,0)
    
    endif
    
    return
    Nicolas thanked this post
    #92481 quote
    Carlos Garcia
    Participant
    Veteran

    Buenas! Da error al ejecutarlo porque dice que hay un bucle infinito y modifique el código

    #92484 quote
    dcastellop
    Participant
    Senior

    Hola en tf 5′ me funciona, tendría que revisarlo.

     

     

    saludos

    #92511 quote
    dcastellop
    Participant
    Senior

    Hola Carlos,  modificando el lookback ya debería funcionar

    // — settings
    ScaleFactor=3
    NbrBars=10
    lookback=150
    // — end of settings

    //PRC_Bull&Bear Volume on Price | indicator
    //05.07.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
     
    //Modificado 28/2/2019
     
    defparam calculateonlastbars=2000
     
    // --- settings
    ScaleFactor=3
    NbrBars=10
    lookback=150
    // --- end of settings
     
    hh=highest[lookback](high)
    ll=lowest[lookback](low)
    div = (hh-ll)/NbrBars
    i=0
    volsum=summation[lookback](volume)
     
    maxbar = 0
    while i<NbrBars do
      lrange=ll+div*i
      hrange=lrange+div
      volbull=0
      volbear=0
      for j = 1 to lookback do
         if close[j]>=lrange and close[j]<=hrange then
            if close[j]>open[j] then
               volbull=volbull+volume[j]
            else
               volbear=volbear+volume[j]
            endif
         endif
      next
      bullbar = round((volbull*lookback)/volsum)*scalefactor
      bearbar = round((volbear*lookback)/volsum)*scalefactor
     
     //VPOC
      if(bullbar>maxbar) then
      vpoclevel = (lrange+hrange)/2
      maxbar=bullbar
      endif
      if(bearbar>maxbar) then
        vpoclevel = (lrange+hrange)/2
        maxbar=bearbar
      endif
      
    i=i+1
    wend
     
    if intradaybarindex=1 then
    yesterdayVPOC=vpoclevel[2]
    drawtext("                                                                                                                                                ---------------------------- yesterday VPOC [#yesterdayVPOC#]----------------------------------------------",barindex[2],vpoclevel[2],dialog,bold,15) coloured(0,0,0)
     
    endif
     
    return
    Carlos Garcia thanked this post
    #92537 quote
    Nicolas
    Keymaster
    Master

    Me alegra que descubras cómo codificarlo y me alegra que hayas aprendido algo, gracias por compartirlo;)

    #92538 quote
    Carlos Garcia
    Participant
    Veteran

    Ahora sí! Muchas gracias 🙂

    #115593 quote
    Gianluca
    Participant
    Master

    Éste agrega el área de volúmenes mínimos con una línea roja, como la forma que desee.

    Disculpe, Nicolas, ¿puede hacer un cambio y asegurarse de que también se muestre una visión global y una visión cotidiana de la versión que hizo?
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Bull & Bear Volume-by-Price levels – modo VPOC


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
oracle @oracle Participant
Summary

This topic contains 14 replies,
has 5 voices, and was last updated by Gianluca
6 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 11/23/2018
Status: Active
Attachments: 5 files
Logo Logo
Loading...