Posts Tagged ‘divergence’

Example Divergence Trade: Netflix (NASDAQ: NFLX)

October 23, 2017

Here’s a divergence trade I took last week in $NFLX, using the Multi-Divergence indicator in my trade plan. 

The setup: NFLX announced earnings on Oct 16.  Price made an all-time high.  I looked at the chart and saw a big divergence on the volume-weighted MACD.  The last big divergence in June led to a big drop. So I was looking to get in a bearish position. 

The candle on Oct 17 is the most recent bar on this chart. I saw that the bar had made the all time high and then fallen down below the prior day’s close, which I took as my bearish entry signal with NFLX at $200. 

The plan: $190 looked like a possible support, and a return to $204 would tell me my timing was wrong. I thought this move should happen in the next few days, so I bought the Nov 3 weekly options 197.5/195 put spread for $0.97.  I chose the 197.5 strike instead of the at-the-money 200 strike because it had higher gamma—it would have a larger change in delta with movement if I was right.  If the move didn’t come in the next day or so, I would get out and move on. 

I didn’t have to wait long:

The day ended red and had a good follow through day next. When the 190 support was nearly hit, I went to take profits. I sold for $1.57, which is a return of about 62%.  I love it when a plan comes together (extra Hannibal).

Note that the divergence indicator wasn’t the entry signal—it just provided context to give me an edge.  Divergences can often resolve with a continuation in the trend instead of a reversal. The context combined with the actual reversal behavior in the daily candles was what led me to take a trade. Always have a plan before you trade, and always follow your plan. My failures have come when I don’t do one or both of those things. 

Multi-Divergence Indicator for Think or Swim: MACD, RSI, CCI, On Balance Volume and many more

January 11, 2015

whatitlookslikenew

I figured out a way to combine all my divergence indicators into one single study. The new Multi-divergence script uses slopes of linear regression lines just like in the new MACD divergence indicator. This script supersedes all the other divergence scripts. The difference is now it can perform a regression on any one study of your choice from a list of ToS indicators. The indicators currently supported for divergence analysis are:

MACD, RSI, CCI, Momentum, Moneyflow, On Balance Volume, Rate of Change, Stochastic Momentum Index, Ultimate Oscillator, Volume Flow Indicator, Volume Oscillator, Volume Rate of Change, Volume-Weighted MACD, Williams Percent-R, and Woodie’s CCI

(Note that it doesn’t scan all of these for divergence at once. Just the one indicator you select. If you want to have RSI and MACD at the same time for example, you put the script on your chart twice and select the appropriate indicator for each one separately.)

If there is another built-in ToS indicator you want to have available for divergence analysis, let me know and I can add it in future updates. You can use the Multi-divergence indicator on real time charts and in scans of watch lists, and I put in alert logic so it can ping you when a divergence occurs.

This indicator is for blog donors only.  You can find it on my google site under Released Thinkscript Studies down in the Donors Only section. If you already donated in the past you can use your password to access it. If you want to become a donor (or throw me some more coin) you can do so by clicking the Donate button:

As always, if you are a DIY’er, feel free to ask questions in the comments and I’ll help answer.

UPDATE: MACD Divergence Indicator for Think or Swim

December 10, 2014

This indicator has been updated!  See the new post here.

This has been a long time in coming.  My family life has been in upheaval for a couple years now.  I finally had a bit of time so I wanted to get this done.  Thanks for staying with me.

Many people have asked for a version of the MACD Divergence Indicator that can run in a scan.  The old one I had ran on recursive logic and so wasn’t supported in scans.  This new one uses a different philosophy that runs in real time.  Before I would use my Swing Points and check the value of the MACD against them.  Higher swing highs and lower corresponding values of MACD on those bars would signal a bearish divergence.  Now I am using Linear Regression slopes to compare divergences.  Here’s the theory of how it works:

A linear regression is a way to fit a straight line through some data such that you get the least amount of average distance from the line. If the slope of the linear regression is up, then values are generally trending upward over the set of data you put in. If the slope is negative, then the values trend downward.

So I take a linear regression of price, then get the slope of the LR, and I also take a linear regression of the standard MACD indicator and get that slope. When the price slope is positive and the MACD slope is negative, we have a bearish MACD divergence. If price slope is negative and MACD slope is positive, we have a bullish divergence. If price slope and MACD slope are the same, we have a trend continuation (up/up or down/down). This chart shows this theory in action:

howitworks

 

Here’s what my indicator actually looks like.  The small arrows are short term divergences, the larger arrows are the long term divergences.  The short and long timeframes are inputs, so you can set them at whatever you want.  This chart uses 20 and 50 as the inputs, but you can experiment with what works best for what you are trading:

whatitlookslikenew

As with all divergences, just because it is there doesn’t mean that the trend must reverse. Sometimes divergences can go on for a long time. This information is good to give you a sense that a trend might reverse, and you can plan your own entry and stop accordingly.

Now, to set set up a custom scan, you follow the instructions in these pictures:

scan1

scan2

Then when your scan runs, you will get flagged if the divergence you asked for is currently found.

This indicator is for blog donors only.  You can find it on my google site under Released Thinkscript Studies down in the Donors Only section.

RSI Divergence Indicator for Think or Swim

January 12, 2010

This indicator has been updated!  See the new post here.

In a similar vein to my MACD and CCI Divergence indicators, here’s an indicator that checks for divergences between RSI and price. It’s basically just a modified version of the CCI divergence indicator I did, but using RSI instead. Also added is a filter that only plots signals if a bearish divergence is in overbought territory, and if a bullish divergence is in the oversold area. There are two indicators. The first, “Pro_RSIDivergence_v1STUDY.ts” looks for when the RSI values diverge from price making new swing highs or lows. The second, “Pro_LowerRSIDivergence_v1STUDY.ts” reverses the process, looking for price to diverge from new swing highs or lows on the RSI indicator itself, and is plotted in the lower panel. I would tend to use the upper one only, but you may want the other one, so I did it. I also added the alert code block that I highlighted earlier, so you can let it run on a chart and get alerted if a divergence shows up.

The two studies are found in “Pro_RSIDivergence_v1.zip” and can be downloaded in the “Donors Only” section of “Released Thinkscript Studies” on my Google site. As always, home-gamers can ask me any questions if they want to make one for free by themselves. The CCI tutorial covers all the same coding I used for this one.

CCI Divergence Indicator for Think or Swim

May 21, 2009

This indicator has been updated!  See the new post here.

I got commissioned to write more divergence indicators, and the customer was generous enough to allow me to share it with the rest of the donors. I say donors because it builds on my donor-only fully variable swing points indicator, so I’m not releasing it freely as a sponsored indicator. If you are a past (or future 🙂 ) donor, you can get it from the “Released Thinkscript Studies” page, called “Pro_CCIDivergence_v1STUDY.zip”. I like this “donor share” idea and will keep doing it as those who commission custom work are willing to share. If you don’t care to donate or you just want to do-it-yourself, it’s not complicated to write your own if you already have a swing points logic built, like I outlined previously. I’ll walk through the additional steps below.

Following on the heels of my Swing Points and MACD Divergence indicators, here’s two more indicators that look for divergences between the CCI and price, and divergences between Price and CCI. There’s one upper study and one lower study.

Every time we get a lower swing low in price, the CCI is checked to see if it also prints a lower value. Similar for highs; higher high without higher CCI is a divergence. Here is a picture of the indicator at work. On the upper frame, the ProCCIDivergence is plotted as a red dot for bearish divergence, and a green dot for bullish divergence. On the lower frame, the opposite divergence is checked. If the CCI has a a lower swing low, the price lows are checked to see if they also print a lower value. Similar for highs; higher CCI swing high without higher price high is a divergence. The colors on the lower plot look backwards, but remember–the lower indicator is plotting a bullish divergence for the value of CCI, NOT the value of price. And as CCI rises, price generally declines.

CCI_Divergence

To make the top study, just follow the MACD divergence tutorial, but in the recursive divergence functions, change the references from MACD to CCI in this way:

input l=14; #This is the CCI input length
rec blCCI = if swinglow then reference CCI(length=l).CCI else blCCI[1];
rec brCCI = if swinghigh then reference CCI(length=l).CCI else brCCI[1];

And there you go. If you also want the lower study, you change it up a bit. The swing point checks are reversed in that you check CCI values for swing highs and lows, and then you define your bullish and bearish divergence recursive functions above to get the value of price if you are at a CCI swing high or CCI swing low, like this:

input l=14; #This is the CCI input length
def CCI=reference CCI(length=l).CCI;
Def swinghigh = if CCI > CCI[1] and CCI > CCI[2] and CCI > CCI[-1] and CCI > CCI[-2] then 1 else 0;
Def swinglow = if CCI < CCI[1] and CCI < CCI[2] and CCI < CCI[-1] and CCI < CCI[-2] then 1 else 0;
rec blPRICE = if swinglow then low else blPRICE[1];
rec brPRICE = if swinghigh then high else brPRICE[1];

Then plot what you want, and go from there! Personally, I think the lower study is less useful than the upper, but you may feel differently.

That’s it! If you are making your own, leave a comment if you have any questions. If you just want to grab mine, donate away: