StockFetcher Forums · Filter Exchange · Quick and dirty 5 day VWAP<< >>Post Follow-up
JoeyVinyl
125 posts
msg #151119
Ignore JoeyVinyl
3/7/2020 5:35:11 PM

I was watching a video where the person was talking about using only the VWAP and EMA(9) (for day trading - they suggested the SMA(9) for swing trading). I'm still learning as much as I can so I thought I'd check the VWAP out. It seems that SF doesn't have that indicator. A quick forum search showed that TRO had worked on it years ago but his filters are usually too complex for me, mainly because I have to decipher what his set variables are for. I couldn't find any other posts where someone had come up with filter phrases to create it. One of my favorite basic learning tools is Investopedia. Here's where I got the formula I used in this code: https://www.investopedia.com/articles/trading/11/trading-with-vwap-mvwap.asp

THIS IS NOT A COMPLETE FILTER. I want to be clear about that. All I was trying to do here was create a way to see a VWAP. It does have two filter phrases but only so I could make columns to show my set statement results. I took those out, btw. It only goes back five days because you need cumulative numbers and more than five days worth would include too many lines (IMO) and probably trigger the "you need the Advanced SF to run this" message.

My expectation is that if you like what I post here and copy it to your filters that you will modify it to your needs so if you want to use this and add more days to it go right ahead. If you can come up with a way to streamline this please do and let me see it! Or if you see any errors in it I'd like to know about those too.

Having said all that, here's the quick and dirty 5 day VWAP code:

Fetcher[/* FIND THE TPV (TYPICAL PRICE * VOLUME) FOR LAST 5 DAYS THEN ADD THEM TOGETHER */
set {tpva, high + low}
set {tpvb, tpva + close}
set {tpvc, tpvb / 3}
set {tpv01, tpvc * volume}
set {tpv02, tpv01 1 day ago}
set {tpv03, tpv01 2 days ago}
set {tpv04, tpv01 3 days ago}
set {tpv05, tpv01 4 days ago}
set {tpv11, tpv01 + tpv02}
set {tpv12, tpv11 + tpv03}
set {tpv13, tpv12 + tpv04}
set {tpv, tpv13 + tpv05}

/* FIND THE CUMULATIVE 5 DAY VOLUME */
set {vol01, volume}
set {vol02, volume 1 day ago}
set {vol03, volume 2 days ago}
set {vol04, volume 3 days ago}
set {vol05, volume 4 days ago}
set {vol11, vol01 + vol02}
set {vol12, vol11 + vol03}
set {vol13, vol12 + vol04}
set {cvol, vol13 + vol05} /* CVOL FOR CUMULATIVE VOLUME */

/* CREATE VOLUME WIEGHTED AVERAGE PRICE (TPV / CVOL) */
set {myvwap, tpv / cvol}

Show stocks where close is > 3
and Average Volume(30) is > 500000

add column separator
add column tpv
add column cvol
add column myvwap
add column separator
add column industry
add column sector

draw myvwap on plot price
]



Cheese
1,374 posts
msg #151120
Ignore Cheese
modified
3/7/2020 7:25:31 PM

@JoeyVinyl,

You are indeed very clever and I like your "myVWAP" very much.

You may find the following links useful
https://www.tradingview.com/wiki/Volume_Weighted_Average_Price_(VWAP)
https://www.tradingview.com/blog/en/built-in-vwap-is-now-calculated-at-dwm-timeframes-16008/

Thank you for sharing

nibor100
1,044 posts
msg #151122
Ignore nibor100
3/8/2020 1:24:06 AM

@ JoeyViny

This should be a lot shorter.
Ed S.

Fetcher[
set {tovo, pp * volume} add column sum(tovo,5)

/* FIND THE CUMULATIVE 5 DAY VOLUME */
set {myvol, avgvol(5)*5} add column myvol

/* CREATE VOLUME WIEGHTED AVERAGE PRICE (TPV / CVOL) */
set {myvwap1, sum(tovo,5) / myvol} add column myvwap1

Show stocks where close is > 3
and Average Volume(30) is > 500000
add column separator
add column industry
add column sector
draw myvwap on plot price
]



JoeyVinyl
125 posts
msg #151124
Ignore JoeyVinyl
3/8/2020 11:56:41 AM

@nibor100

Ed, that's perfect! Thank you!

I have a basic (very basic) understanding of pivot points but haven't looked at them here so this helped me learn the "pp" phrase. I don't think I've ever tried to use sum or avg either, but now I know I can.

I post things in here for two reasons. One, if someone else is trying to do the same thing but having trouble I hope my efforts can help them. And two, so I can learn when someone shows me a better way to do what I'm trying to do. I honestly appreciate all the help.

JoeyVinyl
125 posts
msg #151126
Ignore JoeyVinyl
3/8/2020 12:00:14 PM

@Cheese

Thank you for the links. The more I learn the more I realize this indicator may not be as useful to me as it can be to day traders, but knowledge is rarely a bad thing.

omrangassan
6 posts
msg #160703
Ignore omrangassan
modified
12/7/2023 2:39:22 PM

thanks @nibor100 for the idea of Anchored VWAP.

now am trying to build anchored VWAP screener which does the following:
To build a scanner based on Anchored VWAP.
It will check if the current stock price is between 0.98 and 1.02 of its VWAP Price.
Now how to assign the anchoring point for VWAP for any stock ? anchoring point of VWAP will differ for each stock depending on the stock price chart in the last 6 months (or past 1 year or past x days).
the anchoring point of VWAP (the candle date which VWAP will start from) will be the lowest low (or highest high) that stock made in the past x days or past x weeks.
supposing that we are today at day 0 and we chose to scan for past -180 days : so a stock may put the lowest low in day -133 while other stock may put its lowest low in day -66 and so on.
this lowest low (in past x days) will be the anchoring point for VWAP which will anchor VWAP on it for that specific stock, then to proceed to check if current price of that stock is between 0.98 and 1.02 of its VWAP Price.

if we used the function of [Days Since (DAYS)] to find the anchoring point of the VWAP for any stock to be screened so the procedure will be:
1- find the anchoring point to start VWAP from : each stock will have a different anchoring point depending on the lowest low set by that stock in past X days, not all stocks will have a similar anchoring candle to start from.
2- build VWAP for each stock depending on the anchoring point found in #1 above.
3- check if the current price of that stock is between 0.98 and 1.02 of its VWAP Price.

below is a filter I tried to filter but it does not give result : where is the mistake ? may you help me to build it correctly ?
______________________
Fetcher[

set {Z, days(low reached a new 180 day low, 181)}
and add column Z

set {tovo, pp * volume}

/* FIND THE CUMULATIVE Z DAY VOLUME */
set {myvol, avgvol(Z)*Z}

/* CREATE VOLUME WIEGHTED AVERAGE PRICE (TPV / CVOL) */
set {myvwap1, sum(tovo,Z) / myvol} add column myvwap1

set {xxx, 0.98*myvwap1}
set {yyy, 1.02*myvwap1}

and close is above xxx
and close is below yyy

Show stocks where close is > 3
and Average Volume(30) is > 500000
add column separator
add column industry
add column sector
draw myvwap1 on plot price
]


_________________________

I'll be thankful to get your advice to make it work perfectly.

I'm not sure if am doing it correctly but maybe function varOffset will help ?

StockFetcher Forums · Filter Exchange · Quick and dirty 5 day VWAP<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.