Posts Tagged ‘vwap’

Example Swing VWAP / RSI Divergence Trade: $AAPL

February 8, 2019

Here’s a trade I entered in Apple about 2 weeks ago where I used the Swing VWAP and the RSI MultiDivergence indicators.

Back in January, the market had gone through a good decline. I was watching the RSI divergence on AAPL. Around that time, a big divergence showed up. This was about the largest in the last two years, and is circled on the chart below. Because of that context, I wanted to look for a long entry. After the swing low on January 3, AAPL kept above the Swing VWAP. It pulled back close to the Swing VWAP, and then on January 15 it had a bullish reversal candle (white arrow). That means the bears are losing, since it couldn’t penetrate the lower VWAP. I entered at the end of the day (yellow line) with a stop at the prior day’s low Swing VWAP (red line), and a target at $185 based on prior resistance.

So far, the trade is going according to plan. My stop is at $160 now, and I just have to manage when I take profits–at the predetermined target or in a discretionary manner. I’m really liking the Swing VWAP for how it tracks what side is winning and what side is losing. As a trader, your money comes from the losers. Markets move because they have to, and that happens because people are blown out of their incorrect positions.

ProSwingVWAP: Combining Swing Points with volume-weighted prices to define trends

November 19, 2018

Hello, it’s been a long time.  Life finds a way to get you off track.  I’m trying to get things here up and running again.

This is something I was working on a long time ago, and I just re-visited it this last week.  I think it’s interesting, so here it is: ProSwingVWAP.

2018-11-18-ProSwingVWAP

A VWAP is a volume-weighted average price.  I talked about VWAPs more here.  The idea for this indicator is to use Swing Points to define the period where we start tracking the volume-weighted value.  The chart above shows it in action.  I like using a VWAP as the price input, so you get a running volume-weighted total of each bar’s VWAP.  Kind of a VWAP squared.  You can use close, high, low, etc. as well.

Once a swing point (white dot) is charted, that swing point becomes the first value for that SwingVWAP.  From there, the price value you choose to average for the VWAP is volume-weighted on each bar and the running VWAP is adjusted.  This is done for swing highs (green dots) and swing lows (red dots) separately.  As long as a new swing high / low hasn’t been made, that long / short VWAP value will just continue to build.  A new swing high or low will reset the VWAP and start again.  I added optional paintbars to show green when a bar close is above the swing high VWAP, red if a bar closes below the swing low VWAP, and grey if it closes between them.  I also hide the VWAP value if bars close beyond them.

Because swing points need to have some future values to know if it really is a swing, there is a delay in this indicator.  The more forward bars you require to decide if a swing is in, the longer it will take for the data structure to be confirmed.  If you set the “FlagEarly” input to yes, then paintbars are yellow during this unknown stage.  The fastest reaction is if you use a value of 1 for Swing Forward, but you get more false positives this way too.  I usually use a value of 1 or 2.  The more bars back you look (Swing Back), you get fewer swings but they are bigger ones.  I mess with this value based on the timeframe and the particular name I’m working with, but I’ll usually use 8 or so.

I’m still in the research phase of this one, so I haven’t decided exactly what to do with it yet.  I like how it defines trends.  A bull trend is present when price is closing above the long SwingVWAP, and a bear trend when price is closing below the short SwingVWAP.  I also like the way it shows when a pullback is on, and when the trend resumes.  On the chart above of $SPY, the period from June to October is a prime example.  The market bottomed out at the end of July and then started an uptrend.  When a new swing high was in, the long SwingVWAP (green dots) told us when we were still in the pullback. Once price closed above the long value again, the trend was back on.  The short SwingVWAP kept trailing along below, reminding us that we were in a bull trend.  Then, as October started, we closed below the short SwingVWAP very dramatically, and the correction was on.  Now we seem to be right back in the middle of the two in a holding pattern.

For now it’s a just a context indicator rather than a trading signal, but it looks like it has some potential.  You can get ProSwingVWAP in the “Donors Only” folder in “Released Thinkscript Studies” at my Google site.  It will work on desktop or mobile, but paintbars only work on the desktop platform.

If you’d like to become a blog donor, hit the button below:

Some Work In Progress: Pivot Points Using “VWAP” Instead Of “Close”

May 20, 2009

One thing I have sporadically messed around with is this: What if you made a new Pivot Points calculation, but instead of using yesterday’s High, Low and Close, you used yesterday’s High, Low, and End-of-Day VWAP? Wouldn’t that give you a more “value” based pivot point calculation?

I leave this as an exercise for the reader, as I kind of lost interest with my ADD self and didn’t want to write an article. But since it might be interesting to someone, here it is as a “beta”.

My initial looks said it made the pivot levels wider in general, which I’m not sure is what we would want. In any event, the code is freely available in my “Work in Progress” page under the name “NewPivotVWAPSTUDY.ts”. Mess around with it and feel free to comment on any ideas or observations you may have!

Some Updates

February 23, 2009

I made some updates to VWAPALOOZA and to the Volatility-Based Trailing Stop. Check them out if you’re interested.

VWAPALOOZA

February 19, 2009

UPDATE 23 Feb 2009: Fixed an error in the formatting. Added “Volume Increment”. Changed Incremental and Rolling VWAP’s to calculate for all days on chart, not just current day.

I asked for some indicator requests on Twitter. The most common response was for VWAP, or Volume Weighted Average Price. Think or Swim has a built-in VWAP indicator, but it is a black box. I like my boxes to have source code. Honestly, I’m not quite sure what the built-in “VWAP” indicator is even plotting. In my testing I couldn’t figure it out. It seems to do different things when plotted on daily vs. intraday charts. There is another built-in indicator called “CumulativeVWAP” that is more useful that I’ll discuss below.

There are many ways to define a VWAP. The “standard” way is to multiply each trade by the corresponding trade volume, sum them all, then divide by the total volume traded, like so (from the wikipedia article):

VWAP Formula

This is typically done over a 1 day timeframe.

To remain true to this definition, we would have to calculate VWAP from the tape itself, using time and sales data. Think or Swim does not (yet) support this. The smallest duration we have to work with is the 133 tick chart. So if you define Pj = (bar high + bar low)/2 and use the formula above for a given day, you should get a plot of the VWAP as it was calculated during the day at each corresponding time. As the day starts out, VWAP responds quickly to price changes, but by the end of the day the volume of each bar becomes small compared to total volume. It’s basically an oscillation that gets more damped as the day goes on (barring extreme changes in price or volume). The final value of VWAP on this tick chart at the close should be near to the actual value as calculated from the individual trades. When I plot this VWAP value (in yellow) along with the value of the built-in “CumulativeVWAP” indicator (in black) with timeframe set to “DAY” (hiding the “upper band” and “lower band”), the two curves lie on top of each other:

vwapvscumvwap

Looks good. However, when you move to a larger timeframe, say 30 minute bars, then my Thinkscript (now gray line) loses resolution compared to the “CumulativeVWAP” indicator (now white dots). The “CumulativeVWAP” still shows the same values as in the fine scale 133 tick chart:

vwapvscumvwap_30mins

This leads me to believe that the “CumulativeVWAP” indicator is calculated from time and sales data server-side at ToS. So if you just want a standard VWAP indicator, use “CumulativeVWAP” instead of calculating it yourself.

Now, I’ve seen others (including Richard at Move the Markets) use a type of rolling VWAP. To me, the idea would be that intraday traders near the end of the day can be far removed from the action at the open. They probably have already closed positions from the early morning and are likely to be trading from a different perspective. Calculating a rolling VWAP would let you find a more recent volume-weighted consensus of value. So I wrote a simple “Rolling VWAP” indicator that looks back N number of bars. In the limit as N goes to the total number of bars so far in a day, my “Rolling VWAP” value approaches the “CumulativeVWAP” value (remembering that my calculation loses resolution as your chart timeframe gets larger).

BUT THAT’S NOT ALL!! Order now and you’ll receive an “Incremental VWAP” calculation at no extra charge! The “Incremental VWAP” calculates VWAP over a given period (say N bars). It then waits for N more bars to go by, and then calculates a new VWAP for that most recent N bar period. Here’s all three of my VWAPs– Full Day (cyan dash), Rolling (solid yellow) and Incremental (purple dash)–along with the built-in “CumulativeVWAP” (solid gray) on a 1 min chart of ES from today:

vwap_pro

UPDATE 23 Feb 2009: I also added the option to specify the number of shares as an increment for VWAP rather than just number of bars.

There are many different ways to use VWAP, and hopefully one of these will help you in your trading. The “Incremental VWAP” contains code that uses a counter variable that goes from 1 to N and then resets to 1, so look at the source if that interests you.

Here is the code: (more…)