StockFetcher Forums · Filter Exchange · Quick and dirty 5 day VWAP<< >>Post Follow-up
JoeyVinyl
113 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
785 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
522 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
113 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
113 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.

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 2018 - 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.