I applied this to a watchlist and it appears to run very slow. Took several minutes for the data to show up. So be patient and don’t expect this to be affective at lower time frames where immediate notification is crucial.
I’ll save space here by not including the source code. You can copy/paste that from the standard VWAP chart study that comes with the platform.
First step, you need to remove the following lines from the very bottom of the source code:
plot UpperBand = price + numDevUp * deviation;
plot LowerBand = price + numDevDn * deviation;
VWAP.setDefaultColor(getColor(0));
UpperBand.setDefaultColor(getColor(2));
LowerBand.setDefaultColor(getColor(4));
Then you will change plot VWAP = price;
to read def VWAP = price;
In the final step, you will add these two lines to the bottom of the code:
plot signal = close > open and open < VWAP and close > VWAP;
AssignBackgroundColor(if signal then Color.GREEN else Color.BLACK);
I should mention that your specification leaves a lot left to interpretation. You only asked to change the background color when a green candle crossed the VWAP. You did not mention any other conditions although the screenshot you provided appears to imply there is more. To explain further, you only marked one candle on your screenshot but there are a total of three candles that meet your specification, as stated.
Im sorry if I was a little vague. I’m asking for the first green candle to pass the VWAP line either half or full body on the intraday chart.