Every post in this forum should provide solutions that are applicable to the broadest portion of our audience. Fixed values such a 3 million volume is applicable to a very narrow list of stocks and time frames. It may work for your small list of stocks and specific time frame. But tomorrow that value may be meaningless within that same list of stocks and time frame. Much more useful to have something that will automatically be appropriate regardless of the stock or time frame selected. So let's try to construct this in a way that would apply to all stocks.
Here are some examples of how you would rephrase your specifications to have a much broader application:
- Volume greater than average volume over "x" periods
- Item one but instead we say volume "x" percent or greater than average over "y" periods
- Volume greater than previous "x" bars
- Item 3 but instead we say volume "x" percent or greater than previous "y" bars
- Instead of volume use one of the built-in studies that converts volume into an oscillator that can then be used to determine when extreme volume has appeared.
Ok, there is a nearly endless list of other ways you can do this. But please don't ever try to nail things down to a hard coded value. Much better to apply some statistical tools and formulas to make something that automatically adjusts to the widest range of stocks and time frames.
Edit: Based on feedback from the author of the post I have a solution. The request is for a chart study that paints candles yellow where the volume is greater than 60 period average volume.
input length = 60;
def averageVolume = Average(volume, length);
def lastBar = !IsNaN(close) and IsNaN(close[-1]);
AssignPriceColor(if !lastBar and volume > averageVolume then Color.YELLOW else Color.CURRENT);