VWAP indicator that only plots between 9:30am-10am


Category:
0
0

Hello Pete, I need help creating a VWAP script with the same function as normal default VWAP.

 

But, this modification will only display from 9:30am 10:30am and stay plotted on the chart all day only at those times. (The line will not continue)

 

Thank you for the help

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on June 29, 2021 11:00 am
58 views
0
Private answer

I believe this fits the solution you reqeusted:

input startTime = 930;
input endTime = 1030;
input numDevDn = -2.0;
input numDevUp = 2.0;
input timeFrame = {default DAY, WEEK, MONTH};
def okToPlot = SecondsFromTime(startTime) >= 0 and SecondsTillTime(endTime) >= 0;
plot vwapValue = if okToPlot then reference VWAP(numDevDn, numDevUp, timeFrame).VWAP else Double.NaN;
plot upperBand = if okToPlot then reference VWAP(numDevDn, numDevUp, timeFrame).UpperBand else Double.NaN;
plot lowerBand = if okToPlot then reference VWAP(numDevDn, numDevUp, timeFrame).LowerBand else Double.NaN;
vwapValue.setDefaultColor(getColor(0));
upperBand.setDefaultColor(getColor(2));
lowerBand.setDefaultColor(getColor(4));

Screenshot below shows the results applied to a 15 min chart of AAPL.

Attachments:
Marked as spam
Posted by (Questions: 39, Answers: 3734)
Answered on June 29, 2021 11:14 am
beautiful, thank you
( at June 29, 2021 2:50 pm)