volume on price
Forums › ProRealTime English forum › ProBuilder support › volume on price
- This topic has 11 replies, 4 voices, and was last updated 6 years ago by robert123.
-
-
11/28/2017 at 3:03 PM #54283
Nicholas, herewith the lastest offering…any thoughts?
Robert
defparam CALCULATEONLASTBARS=2000
bi=barindex
i=100
//define first time factor
factor=bi/iif bi=(i*factor) then
factor=round(factor)
endif
if factor<>factor[1] then
b=bi
endif
count=0
while b=b[1] do
count=count[1]+1
break
wend
counter=round(count)
ii=0
for ii=ii to counter[100] do
if factor[0]>factor[1] thenDRAWVLINE(barindex[0])
endif
next
for ii= 1 to counter[100] do
if counter[0]>1 and close[0]>open[1] thenDRAWSEGMENT((barindex[0]-counter[0])+(volume[0]), close[0],(barindex[0]-counter[0]), close[0]) coloured(0,255,0)
endifbreak
break
next
for ii= 1 to counter[100] do
if counter[0]>1 and close[0]<open[1] thenDRAWSEGMENT((barindex[0]-counter[0])+(volume[0]), close[0]+.1,(barindex[0]-counter[0]), close[0]+.1) coloured(255,0,0)
endifbreak
break
nextreturn close[0]
1 user thanked author for this post.
11/28/2017 at 3:10 PM #5428411/28/2017 at 5:37 PM #54292Very nice Robert!
> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
I’m trying to read your code, but I don’t really understand why you are making loops but not using their increments in your calculation? You are also adding Volume to Barindex to create coordinate for segments?! Is this a way to simulate their weight between them?
11/28/2017 at 8:16 PM #54300Thank you Nicholas,
The Vertical line is the tether point. I.E every X bars or (i=100). I am …and have …for a while now …been trying to code it so that the volume bar is tether to the vertical, the use of the ‘segment’ is indeed the volume wieght.(DRAWSEGMENT((barindex[0]-counter[0])+(volume[0]), close[0],(barindex[0]-counter[0]), close[0]) coloured(0,255,0))
I hope this makes sense( although i doubt it!)
If you think you can stream line this I would be grateful if you could give it a go…as my coding runs along the ‘blind pig’ pig method.
Robert
11/29/2017 at 5:52 PM #54377About the vertical line, I understood the principle. I know that it is a big problem to calculate all the volumes by price zones and draw them on the graph with a weighted weight vis-à-vis all the other volumes already found (and without arrays!), This is why I have not yet managed to code something really satisfying. In this sense I congratulate you for the work done here. But, without wanting to offend you, the way you coded the indicator is a bit “weird” for me 🙂 Especially about loops that are useless so I don’t know where to start to help you finish it 🙂
11/29/2017 at 6:23 PM #5437811/29/2017 at 6:27 PM #54379At the bottom of the linked page is the code you gave me for higher time frames. It is the start of the volume profile code.
https://www.prorealcode.com/topic/code-for-one-tick-time-frame-to-another/
11/29/2017 at 7:26 PM #54382Here is a cleaned up version!!
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849defparam CALCULATEONLASTBARS=2000bi=barindexi=39//define first time factorfactor=bi/iif bi=(i*factor) thenfactor=round(factor)endifif factor<>factor[1] thenb=biendifcount=0while b=b[1] docount=count[1]+1breakwendfor i= .1 to count[100] doif count[0]>.01 and close[0]>open[0] thenDRAWRECTANGLE((barindex[0]-count[0])+(volume[0]), close[0]+.02,(barindex[0]-count[0]), close[0]+.01) coloured(0,255,0)endifbreakbreaknextfor i= .1 to count[100] doif count[0]>.01 and close[0]<open[0] thenDRAWRECTANGLE((barindex[0]-count[0])+(volume[0]), close[0]+.03,(barindex[0]-count[0]), close[0]+.04) coloured(255,0,0)endifbreakbreaknextreturn close[0]12/01/2017 at 11:40 AM #54466Very interesting Robert, why do not you see it on a daily basis?
1 user thanked author for this post.
12/03/2017 at 8:53 PM #54609Bolsatrilera, it will work if you play about with the volume…I.E
Instead of the below ..
DRAWRECTANGLE((barindex[0]–count[0])+(volume[0]), close[0]+.02,(barindex[0]–count[0]), close[0]+.01) coloured(0,255,0)endifTry…DRAWRECTANGLE((barindex[0]–count[0])+(volume[0]/1000), close[0]+.02,(barindex[0]–count[0]), close[0]+.01) coloured(0,255,0)endifhope that helps.12/12/2017 at 10:46 AM #55460Hi Robert – really very cool – even for a pig coder 🙂
It is clunky but I think this is necessary to overcome some of the shortcomings in PRT.
FWIW tweak i=20 and the volume statement to (volume[0]/100) to get it to work with a 100 tick CL chart, (on IG).
Good Luck
Copperwave
12/12/2017 at 5:29 PM #55517 -
AuthorPosts
Find exclusive trading pro-tools on