How To Plot My Custom Volume Indicator To Right Side Of The Chart?

68 views Asked by At

I am trying to plot my custom volume indicator to the right side of the chart, similar to the Visable Volume Profile indicator. (Image at bottom of post) The following is the code for the indicator:

indicator("My script", overlay = true, scale = scale.none)
lengthMA=input(20)
hi=input(100, title="size")

dv = hl2 * volume
dvh3 = ta.highestbars(hi) * volume * 3
barcolor = if close < open
    color.red
else
    color.green
    
plot(dv, color=barcolor, linewidth=10, style=plot.style_columns, transp=60)

Here is how the indicator looks as of now with where I want it plotted circled in white: enter image description here

I have tried using offset with -bar_index to plot the volume on the right side of the chart..

Example :

plot(dv, color=color.blue, style=plot.style_columns, title="Volume", offset=-bar_index)

This plotted the label on the right side of the chart, but didn't show the indicator at all.

I have also tried using scale in the top line, with the title of the indicator... Example:

indicator("My script", scale = scale.right)

This did nothing different from what I could tell.

What I was expecting from both of these attempts is to be plotted on the chart similar to the Visible Volume Profile Range indicator (Image Below): Visable Volume Profile Indicator

0

There are 0 answers