Nigel Hawks volume indicator
Forums › ProRealTime English forum › ProBuilder support › Nigel Hawks volume indicator
- This topic has 10 replies, 2 voices, and was last updated 1 year ago by SVK.
-
-
07/28/2023 at 9:30 PM #218276
Hi all,
would it be possible to translate PineScript indicator to Prorealcode please ?
Thank you very much
HawkEye volume, developed by Nigel Hawks, is supposed to be a premier VSA indicator.
// @author LazyBear// If you use this code, in its original or modified form, do drop me a note. Thx.//study(“HawkEye Volume Indicator [LazyBear]”, shorttitle=”HVI_LB”)length=input(200)range=high-lowrangeAvg=sma(range,length)volumeA=sma(volume, length)divisor=input(3.6)high1=high[1]low1=low[1]mid1=hl2[1]u1 = mid1 + (high1-low1)/divisord1 = mid1 – (high1-low1)/divisorr_enabled1 = (range > rangeAvg) and (close < d1) and volume > volumeAr_enabled2 = close < mid1r_enabled = r_enabled1 or r_enabled2g_enabled1 = close > mid1g_enabled2 = (range > rangeAvg) and (close > u1) and (volume > volumeA)g_enabled3 = (high > high1) and (range < rangeAvg/1.5) and (volume < volumeA)g_enabled4 = (low < low1) and (range < rangeAvg/1.5) and (volume > volumeA)g_enabled = g_enabled1 or g_enabled2 or g_enabled3 or g_enabled4gr_enabled1 = (range > rangeAvg) and (close > d1) and (close < u1) and (volume > volumeA) and (volume < volumeA*1.5) and (volume > volume[1])gr_enabled2 = (range < rangeAvg/1.5) and (volume < volumeA/1.5)gr_enabled3 = (close > d1) and (close < u1)gr_enabled = gr_enabled1 or gr_enabled2 or gr_enabled3v_color=gr_enabled ? gray : g_enabled ? green : r_enabled ? red : blueplot(volume, style=histogram, color=v_color, linewidth=5)07/29/2023 at 1:02 AM #218278Hi @SVK
Hereby the translation of the HawkEye Volume Indicator…
123456789101112131415161718192021222324252627282930313233343536Length=200xRange=RangeRangeAvg=Average[Length](xRange)VolumeAvg=Average[Length](Volume)Divisor=3.6High1=High[1]Low1=Low[1]Mid1=(High1+Low1)/2u1=Mid1+(High1-Low1)/Divisord1=Mid1-(High1-Low1)/DivisorREnabled1=(xRange>RangeAvg) and (Close<d1) and (Volume>VolumeAvg)REnabled2=Close<Mid1REnabled=REnabled1 or REnabled2GEnabled1=Close>Mid1GEnabled2=(xRange>RangeAvg) and (Close>u1) and (Volume>VolumeAvg)GEnabled3=(High>High1) and (xRange<RangeAvg/1.5) and (Volume<VolumeAvg)GEnabled4=(Low<Low1) and (xRange<RangeAvg/1.5) and (Volume>VolumeAvg)GEnabled=GEnabled1 or GEnabled2 or GEnabled3 or GEnabled4GREnabled1=(xRange>RangeAvg) and (Close>d1) and (Close<u1) and (Volume>VolumeAvg) and (Volume<VolumeAvg*1.5) and (Volume>Volume[1])GREnabled2=(xRange<RangeAvg/1.5) and (Volume<VolumeAvg/1.5)GREnabled3=(Close>d1) and (Close<u1)GREnabled=GREnabled1 or GREnabled2 or GREnabled3If GREnabled thenR=128G=128B=128ElsIf GEnabled thenR=0G=255B=0ElsIf REnabled thenR=255G=0B=0EndIfReturn Volume as "Volume" Coloured(R,G,B) Style(Histogram,2)2 users thanked author for this post.
07/30/2023 at 10:12 AM #218311JS,
thank you very much for your help.
Works perfect 🙂
Would you know how can I incorporate signals from this indicator into strategy ?
Signals would be only Green & Red bars.Divisor setting I’m using is 1.5 which reduces amount of green & red bars significantly.
Thank you very much for your help
PS.
If you have Paypal I’m more than happy to send you some beer money 🙂
07/30/2023 at 10:35 AM #218312Hi SVK,
As you’ve probably noticed, Renabled stands for “Red (enabled)”, Genabled for “Green (enabled)” and GREnabled for “Grey (enabled)”…
If you want to use the green and red signals in a system, you will end up with the following:
If GEnabled then
Buy 1 contract at Market
EndIf
If REnabled then
SellShort 1 contract at Market
EndIf
Thanks for the offer but is not necessary… 🙂
HawkEye System12345678910111213141516171819202122232425262728293031DefParam CumulateOrders=FalseLength=200xRange=RangeRangeAvg=Average[Length](xRange)VolumeAvg=Average[Length](Volume)Divisor=1.5High1=High[1]Low1=Low[1]Mid1=(High1+Low1)/2u1=Mid1+(High1-Low1)/Divisord1=Mid1-(High1-Low1)/DivisorREnabled1=(xRange>RangeAvg) and (Close<d1) and (Volume>VolumeAvg)REnabled2=Close<Mid1REnabled=REnabled1 or REnabled2GEnabled1=Close>Mid1GEnabled2=(xRange>RangeAvg) and (Close>u1) and (Volume>VolumeAvg)GEnabled3=(High>High1) and (xRange<RangeAvg/1.5) and (Volume<VolumeAvg)GEnabled4=(Low<Low1) and (xRange<RangeAvg/1.5) and (Volume>VolumeAvg)GEnabled=GEnabled1 or GEnabled2 or GEnabled3 or GEnabled4GREnabled1=(xRange>RangeAvg) and (Close>d1) and (Close<u1) and (Volume>VolumeAvg) and (Volume<VolumeAvg*1.5) and (Volume>Volume[1])GREnabled2=(xRange<RangeAvg/1.5) and (Volume<VolumeAvg/1.5)GREnabled3=(Close>d1) and (Close<u1)GREnabled=GREnabled1 or GREnabled2 or GREnabled3If GEnabled thenBuy 1 contract at MarketEndIfIf REnabled thenSellShort 1 contract at MarketEndIf1 user thanked author for this post.
07/30/2023 at 11:00 AM #21831307/30/2023 at 11:10 AM #21831407/30/2023 at 11:14 AM #218315I have done following and it doesn’t work 🙁
On a graph you can see that Grey bars are highlighted as green.
1234567891011121314151617181920212223242526272829//VolumeLength=200xRange=RangeRangeAvg=Average[Length](xRange)VolumeAvg=Average[Length](Volume)Divisor=1.5High1=High[1]Low1=Low[1]Mid1=(High1+Low1)/2u1=Mid1+(High1-Low1)/Divisord1=Mid1-(High1-Low1)/DivisorREnabled1=(xRange>RangeAvg) and (Close<d1) and (Volume>VolumeAvg)REnabled2=Close<Mid1REnabled=REnabled1 or REnabled2GEnabled1=Close>Mid1GEnabled2=(xRange>RangeAvg) and (Close>u1) and (Volume>VolumeAvg)GEnabled3=(High>High1) and (xRange<RangeAvg/1.5) and (Volume<VolumeAvg)GEnabled4=(Low<Low1) and (xRange<RangeAvg/1.5) and (Volume>VolumeAvg)GEnabled=GEnabled1 or GEnabled2 or GEnabled3 or GEnabled4GREnabled1=(xRange>RangeAvg) and (Close>d1) and (Close<u1) and (Volume>VolumeAvg) and (Volume<VolumeAvg*1.5) and (Volume>Volume[1])GREnabled2=(xRange<RangeAvg/1.5) and (Volume<VolumeAvg/1.5)GREnabled3=(Close>d1) and (Close<u1)GREnabled=GREnabled1 or GREnabled2 or GREnabled3IF GEnabled thenVolumeON = 1ELSEVolumeON = 0ENDIF07/30/2023 at 11:45 AM #218319Tried code on it’s own and I’m getting the same result.
I have added green vertical lines to highlight where Red graph should allign with.
123456789101112131415161718192021222324252627282930313233DefParam CumulateOrders=FalseLength=200xRange=RangeRangeAvg=Average[Length](xRange)VolumeAvg=Average[Length](Volume)Divisor=1.5High1=High[1]Low1=Low[1]Mid1=(High1+Low1)/2u1=Mid1+(High1-Low1)/Divisord1=Mid1-(High1-Low1)/DivisorREnabled1=(xRange>RangeAvg) and (Close<d1) and (Volume>VolumeAvg)REnabled2=Close<Mid1REnabled=REnabled1 or REnabled2GEnabled1=Close>Mid1GEnabled2=(xRange>RangeAvg) and (Close>u1) and (Volume>VolumeAvg)GEnabled3=(High>High1) and (xRange<RangeAvg/1.5) and (Volume<VolumeAvg)GEnabled4=(Low<Low1) and (xRange<RangeAvg/1.5) and (Volume>VolumeAvg)GEnabled=GEnabled1 or GEnabled2 or GEnabled3 or GEnabled4GREnabled1=(xRange>RangeAvg) and (Close>d1) and (Close<u1) and (Volume>VolumeAvg) and (Volume<VolumeAvg*1.5) and (Volume>Volume[1])GREnabled2=(xRange<RangeAvg/1.5) and (Volume<VolumeAvg/1.5)GREnabled3=(Close>d1) and (Close<u1)GREnabled=GREnabled1 or GREnabled2 or GREnabled3If GEnabled thenBuy 1 contract at MarketEndIf// Stops and targetsSET STOP pLOSS 11SET TARGET pPROFIT 11graph GEnabled coloured(220,20,60) //RED07/30/2023 at 11:55 AM #218321Hi SVK,
Strange, I think it’s because there’s an overlap between the different conditions…
When you try like this you get the right result…
HawkEye System12345678910111213141516171819202122232425262728293031//VolumeLength=200xRange=RangeRangeAvg=Average[Length](xRange)VolumeAvg=Average[Length](Volume)Divisor=1.5High1=High[1]Low1=Low[1]Mid1=(High1+Low1)/2u1=Mid1+(High1-Low1)/Divisord1=Mid1-(High1-Low1)/DivisorREnabled1=(xRange>RangeAvg) and (Close<d1) and (Volume>VolumeAvg)REnabled2=Close<Mid1REnabled=REnabled1 or REnabled2GEnabled1=Close>Mid1GEnabled2=(xRange>RangeAvg) and (Close>u1) and (Volume>VolumeAvg)GEnabled3=(High>High1) and (xRange<RangeAvg/1.5) and (Volume<VolumeAvg)GEnabled4=(Low<Low1) and (xRange<RangeAvg/1.5) and (Volume>VolumeAvg)GEnabled=GEnabled1 or GEnabled2 or GEnabled3 or GEnabled4GREnabled1=(xRange>RangeAvg) and (Close>d1) and (Close<u1) and (Volume>VolumeAvg) and (Volume<VolumeAvg*1.5) and (Volume>Volume[1])GREnabled2=(xRange<RangeAvg/1.5) and (Volume<VolumeAvg/1.5)GREnabled3=(Close>d1) and (Close<u1)GREnabled=GREnabled1 or GREnabled2 or GREnabled3IF GEnabled and NOT REnabled and NOT GREnabled thenVolumeON = 1ELSEVolumeON = 0ENDIFReturn VolumeOn as "VolumeON" Coloured("Green")1 user thanked author for this post.
07/30/2023 at 12:13 PM #21832307/30/2023 at 6:59 PM #218337 -
AuthorPosts
Find exclusive trading pro-tools on