Hello and good sunday to everybody.
I made an indicator which try to define the directional volume.
When i plot the directional volume alone, it gives me positive and negative volume.
The problem is when i make the cumsum instruction that sums up the directional volume (like the obv), where sometimes doesn’t work.
I add the plots of 2 stocks where it works and where it doesn’t work (it remains flat at 1 valour) and the code of my directional volume.
Can you help me to fix it?
Thanks a lot
Max
c1= open - close [ 1 ]
c2= close - open
c3= (range - (abs (c2)))* 2
c4= abs (c1)+ abs (c2)+ c3
c5= 100 / c4* c1
c6= 100 / c4* c2
c7= (volume * c5)/ 100
c8= (volume * c6)/ 100
dirvolume= c7+ c8
c9= cumsum (dirvolume)
return c9 as "acc/disrt" , 0 as "0"