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
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
Gracias Nicolas. Eres un tio genial..
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.
É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
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.
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.
Gracias por responder, hay algún indicador que muestre el vpoc del día anterior?
saludos.
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
Buenas! Da error al ejecutarlo porque dice que hay un bucle infinito y modifique el código
Hola en tf 5′ me funciona, tendría que revisarlo.
saludos
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
Me alegra que descubras cómo codificarlo y me alegra que hayas aprendido algo, gracias por compartirlo;)
Ahora sí! Muchas gracias 🙂
É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?