odinParticipant
Veteran
hello guys,
this nice code is from nicolas. its a great indicator. but i cannot build it up for the pro screener so please help.
i wann search the highest indicator values of the last 12 nbr bars, to get the screenings result.
//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 = 5
NbrBars=12
lookback=200
// --- end of settings
hh=highest[lookback](high)
ll=lowest[lookback](low)
div = (hh-ll)/NbrBars
i=0
volsum=summation[lookback](volume)
startbar = barindex[lookback]
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
i=i+1
wend
drawvline(barindex[lookback])
return
here is my try but it doesnet work:
//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 = 5
NbrBars=12
lookback=200
// --- end of settings
hh=highest[lookback](high)
ll=lowest[lookback](low)
div = (hh-ll)/NbrBars
i=0
volsum=summation[lookback](volume)
startbar = barindex[lookback]
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
endif
c1 = highest[12](bullbar)[1] < bullbar
c2 highest[12](bearbar)[1] < beabar
c3 = c1 or c2
SCREENER[c3 ] sort by volume*close
thanks for help!
odinParticipant
Veteran
for this values i wanna screen:
odinParticipant
Veteran
here is the chart i wanna search for:
can some help, for examplage nicolas?
I’ll have a look this week. Please don’t double post, I saw the same request in the german forum too..
odinParticipant
Veteran
hello nicolas, great. thank you thank you.
and sorry for my double post. i thougt no one would help me.
next topic i wanna post just one time.
good start to the week.
odin
I made some tests and the problem is that ProScreener is quickly falling into the infinite loop issue.. Reducing the bars and lookback could probably make it possible, but it should also make the screener useless!
Here is the code in its actual state, not accurate, still don’t understand why. I put it here for future reference if needed..
// --- settings
ScaleFactor = 5
NbrBars=10
lookback=50
// --- end of settings
//if date=today then
hh=highest[lookback](high)
ll=lowest[lookback](low)
div = (hh-ll)/NbrBars
i=0
volsum=summation[lookback](volume)
//startbar = barindex[lookback]
maxi=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
maxi=max(maxi,max(bearbar,bullbar))
if maxi>lastmaxi then
lastmaxi=maxi
result=(lrange+hrange)/2
endif
//drawrectangle(startbar,lrange,startbar+bullbar,hrange) coloured(46,139,87)
//drawrectangle(startbar,lrange,startbar+bearbar,hrange) coloured(255,0,0)
i=i+1
wend
//endif
screener[result](result)
odinParticipant
Veteran
Hi Nicolas, some result are very good bottom Buys,
but after 10 results the screener goes to exit… because a loop is detected…
you are a monster at coding. wow 🙂
its not perfect but help me well.
thank you