Display daily volume on last bar of intraday chart


Category:
0
0

Hello Pete ,

 

I wanted to know if you could help me write a script that shows the current total volume on the day as a text (No bubble) on the close price of the current candle only.

 

If the volume is over 9 million, no longer display the number.

 

Thank you

Marked as spam
Posted by (Questions: 3, Answers: 3)
Asked on August 29, 2021 8:12 am
45 views
0
Private answer

In order to make this solution useful for the broadest possible audience I have included user inputs to select the multiplier and length for average volume as well as the time frame.

You requested a specific value for the volume limit, however using a fixed value would make this solution extremely narrow in it's scope. The solution I have provided will automatically adjust based on the average volume and multiplier entered by each user.

input multiplier = 1.0;
input length = 14;
input timeFrame = AggregationPeriod.DAY;
def dailyVolume = volume(period = timeFrame);
def averageVolume = Average(dailyVolume, length);
def lastBar = !IsNaN(close) and IsNaN(close[-1]);
plot volumeLabel = if lastBar and dailyVolume < averageVolume * multiplier then dailyVolume else Double.NaN;
volumeLabel.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);

Marked as spam
Posted by (Questions: 39, Answers: 3752)
Answered on August 29, 2021 2:00 pm
omg u are a rockstar. Ty
( at August 29, 2021 5:32 pm)
oh, i see the value post at the High, how can we make this value post at close price off candle instead?
( at August 29, 2021 5:52 pm)
fixed, i placed at low, it works just as well
( at August 29, 2021 5:53 pm)
Glad you figured out how to adjust it. There is no way to have it plot at the close. But even it were possible that would be unwise as it would obscure the price action for the last few bars on the chart.
( at August 29, 2021 6:41 pm)