I updated the title of your question to include the full context of your request. The title you choose was lacking important details which help the rest of our viewers to find this type of solution using the search function.
And speaking of the rest of our viewers. The solutions provided in this forum are intended to serve the interests of the majority of our viewers. I keeping with this, I have modified your specifications to include a moving average of the volume with two user inputs. One controls the length of that moving average. The other controls the multiplier applied to the average volume.
In this way, the solution is able to quickly and automatically adapt to a wide variety of ticker symbols and time frames. You can adjust those inputs to fit your own specific requirements.
Here is the solution I created:
input averageLength = 14;
input avgVolumeMultiplier = 2.0;
def averageVolume = Average(volume, averageLength);
def targetBar = volume > averageVolume * avgVolumeMultiplier;
rec trackHigh = if targetBar then high else trackHigh[1];
rec trackLow = if targetBar then low else trackLow[1];
plot highVolumeHigh = trackHigh;
highVolumeHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
highVolumeHigh.SetDefaultColor(Color.DARK_GREEN);
plot highVolumeLow = trackLow;
highVolumeLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
highVolumeLow.SetDefaultColor(Color.DARK_RED);
The screenshot below shows the result. I have placed the cross-hairs of the chart over one of the bars which meets the high volume limit. You can see the average volume for that bar is 5.7 million and the bar that generated those lines has a volume of 7.6 million.