Intraday VWAP? TOS


Category:
0
0

I want to run 2 vwaps at the same time on a 1 min TOS chart with pre market on.  I am using the standard TOS vwap for one.  The other one that I built and have posted below was intended to only be during intraday.  I realized that the only way this works is when i turned off the PM but that defeats my desired result as I want to compare the pre marked vwap to the intraday.   The solution I think I need to this code is to start it only at 9.30 am market open for my vwap.  Only issue is I am having dificulty figuing out how to add that code.  Anyone have any ideas?

My Vwap code below:

input startDateYyyyMmDd = 20090309;
def beyondStartDate = if getYyyyMmDd()>= startDateYyyyMmDd then 1 else 0;

plot VWAP = TotalSum(if beyondStartDate then (((high+low+close)/3)*volume) else 0)/TotalSum(if beyondStartDate then volume else 0);

VWAP.SetDefaultColor(color.orange);
VWAP.SetStyle(curve.SHORT_DASH);
VWAP.SetLineWeight(2);

Marked as spam
Posted by (Questions: 3, Answers: 2)
Asked on October 17, 2020 9:49 am
400 views
0
Private answer

Before I attempt to solve this I see that you posted this in the "Stock Scanners" topic but from your description you are requesting a chart study. Once we get that sorted out please confirm that I understand your request.

First you have standard VWAP indicator (the one provided by Thinkorswim) plotted on an intraday chart with the extended hours trading session included and the "time frame" input set to DAY. Yes?

The custom solution you are seeking is the same VWAP indicator but instead of resetting the values at the first trade of the new day, you would instead like this custom version to reset at a specific time of day, in this case the 9:30 Am regular session open.

Did I understand that correctly? If so, you cannot do this using the method in your example. You must use the entire code provided with the VWAP chart study that comes with Thinkorswim and you will need to add a time input and add a new option to the "time frame" input. Once those pieces are in place you need to modify the rest of the code to make use of those user inputs.

This is probably quite a bit more complex than I should provide free of charge in the Q&A forum. I have clients who have paid for less complicated solutions than this.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 17, 2020 10:41 am