iBankCoin
Joined Nov 11, 2007
1,458 Blog Posts

Varadi’s DV2 vs. Wilder’s RSI2: Trading the Divergence

In case you hadn’t noticed, there is a new sheriff in town, and his name is DV2. The DV2 is a new indicator developed by David Varadi of CSS Analytics blog fame. For the best overview of how this indicator works, including how to calculate it, see this series of posts.

While there has been a great deal already written about this indicator (geeks are easily excited by such things as new formulas), one aspect that has been mentioned but not yet reviewed in the quant blogosphere is that a divergence between DV2 and RSI2 may allow forecasting of future returns.

The Method:

Entry: Go long the SPY if the difference yesterday between RSI2 and DV2 < 5 and the difference today > 5.

Exit: An n day exit (geek speak for a time based exit) will be used.

All trades are opened and closed at the close, and no commissions were used. While I prefer testing opening and closing trades on the open, my rate-of-change calculations were already set up using the closing prices.

The Results:

rsi2-dv2

The blue line illustrates the average daily change after buying the SPY when the difference between RSI2 and DV2 is greater than 5. The red line is the average daily rate-of-change of the SPY, calculated using all of its history.

The graph demonstrates that there is an edge. In terms of efficiency (profits per day) it appears that the edge is strongest over the next 4 days following the divergence.

Summary:

The results show that there can be situations where RSI2 has risen to extreme heights without confirmation from DV2. Traditionally, a high RSI2 would have signaled to sell a long position or go short. The addition of DV2 can help traders judge when the market might have room for additional upside, despite an extreme RSI2 reading. This phenomenon is best illustrated by looking at a chart of the two indicators with the SPY (below).

spy-rsi2-and-dv2-divergence1

The green arrows show all raw entry possibilities. There were many times over the past several months were DV2 did not confirm RSI2, and a divergence developed. The divergence can alert traders to the possibility of more upside.

Further Research:

In the future I will examine what happens when the opposite divergence occurs (DV2 is higher than RSI2). Also, an extreme divergence where (RSI2-DV2)>50 will be examined to determine any implications for forecasting future returns.

Should anyone find the DV2 to be a valuable addition to his toolbox, Mr. Varadi will be releasing the DV2 along with a whole suite of indicators, including a super-charged DV2, in the very near future. Be sure to visit his blog for more information.

If you enjoy the content at iBankCoin, please follow us on Twitter

15 comments

  1. bill

    Shed,

    will be possible for you to share some of the code of amibroker which you dont plan to sell and Ok with sharing.

    I am trying to code something like buy a 10 day or 7day low and sell a 7 day high and partially exit on a 10 day high.

    thanks
    Bill

    • 0
    • 0
    • 0 Deem this to be "Fake News"
    • Woodshedder

      Yeah, I have some simple stuff that will get you started. I think I already have a 7 day low and 7 day high system coded, but not with scaling out exits. You’ll have to figure out that part. Is the email you provided in the comment a real email address?
      I’ll try and send you an .afl tomorrow evening.

      I recommend downloading the manual and beginning to work through it. Also, you might consider one of Howard Bandy’s books.

      • 0
      • 0
      • 0 Deem this to be "Fake News"
  2. Yogi & Boo Boo

    Thanks Wood, great stuff. Always the problem with oscillators, strongly trending markets, and discretionary traders. I stopped looking for evidence of tops long ago, therefore my exits are always problematic. I’m currently experimenting with overall PPT hybrid to take some off the table and reallocate to other sectors.

    • 0
    • 0
    • 0 Deem this to be "Fake News"
    • Woodshedder

      Yogi, just like with entries, you’ll never get the exits perfect. Just get the exits good enough that you have positive expectancy great enough to cover your commissions and still leave some jingle in your man purse.

      • 0
      • 0
      • 0 Deem this to be "Fake News"
    • DPeezy

      Dr.SimpleExit or How I Stopped Worrying and Learned to Love the Exit.

      #1 rule has got to be to never let a winning position turn into a losing one. At least for me. Rather unbelievably I’ve failed to follow this myself over the last several weeks and have suffered for it.

      ________

      Seeing as how I’m an RSI(2) aficionado, I will have to check out this DV2…

      • 0
      • 0
      • 0 Deem this to be "Fake News"
  3. bill

    Thanks wood, yes my email id is for real.

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  4. Aristotle

    Good stuff Woodrow! That’s wat I’m talkin’ about!

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  5. Erik

    Great stuff, and it’s nice to see more and more Amibroker users out there.

    What method did you use to create the “bind” the DV2 to the past 252 bars? I’ve been looking for a way to replicate the Excel PERCENTRANK func in AFL, but am still stumped. I assume one probably needs to loop through the past 252 bars?

    Any sample code you are willing to share?

    -Erik

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  6. Woodshedder

    Erik, thanks, glad to meet another AB user as well.

    As for the Excel PERCENTRANK func, you have the gist of it, as it does require looping. I need to check with someone and see if I can share the actual code. It really is pretty simple, once you see it.

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  7. Ray Safaie

    Hi wood,
    i am a ETF rewind subscriber and came across your article. Would you be able to share the calculation and/or tradestation code for this indicator? I’d like to see how it works Intraday…
    thanks in advance, Ray
    my email: [email protected]

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  8. Alf

    Hi Woodrow, would you mind sending the .afl code for the DV2 indicator to me too? Email is alfred . omega @ gmail . com (no spaces of course). Thanks…

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  9. Woodshedder

    Alf, email David Varadi at CSS Analytics blog. I posted the percenrank function with permission from the programmer, but do not have permission to post the DV2.

    • 0
    • 0
    • 0 Deem this to be "Fake News"
  10. adel

    can you snde to me the divergence indecator
    by .afl format >> i’ll work that with amibroker program>>

    thanks

    adel

    • 0
    • 0
    • 0 Deem this to be "Fake News"