Recreate "Precision Divergence Finder Indicator"? - Traders Hideout | futures io social day trading
futures io futures trading


Recreate "Precision Divergence Finder Indicator"?
Updated: Views / Replies:12,522 / 28
Created: by tdaman Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 3  
 
Thread Tools Search this Thread
 

Recreate "Precision Divergence Finder Indicator"?

  #11 (permalink)
Elite Member
Singapore
 
Futures Experience: Intermediate
Platform: NinjaTrader, Sierra Charts
Broker/Data: Thinkorswim, IQFeed
Favorite Futures: Options of SPY, IWM, QQQ
 
wccktrader's Avatar
 
Posts: 47 since Nov 2010
Thanks: 54 given, 141 received


Fat Tails View Post
The divergence finder is based on the Demand Index by James Sibbet.

As far as I know, there is no version of the Demand Index for NinjaTrader, so the first step would be to code the Demand Index. Below is a link with the code and some explanations.

Re: Sibbet's Demand Index, Omega TradeStation Email Archive | PureBytes.Com

Further information on the Demand Index can be found in.

Robert W. Colby: The Encyclopedia of Technical Market Indicators
Thomas E.Aspray: Fine-Tuning the Demand Index in TASC Vol. 4:4, pp 141-143

V.4:4 (141-143): Fine-tuning the demand index by Thomas E. Aspray

Once you got the Demand Index you need to look for divergences. The divergence finder possibly scans for divergences, using different periods for the Demand Index and then adds them up.

The idea is not bad at all. Divergence stands for a weakening = loss of momentum of a prevailing trend, not yet its reversal. If the trend is weakening across various timeframes a reversal might be imminent.

However, I believe that the indicator also will produce a significant number of false signals, as is usually the case with unfiltered divergences.


Perhaps another way to scan for divergences is to have a correlation indicator that shows the correlation for a certain lookback period between the Demand Index and closing price. If the correlation falls below 0.4, we have a divergence and if it falls below 0, we have a negative divergence. I could find a correlation indicator in NT that shows correlation between 2 instruments but not between an indicator and price. If someone could code such a correlation indicator, if could flag out divergences between price and any momentum indicators (e.g. Demand Index, RSI, MACD Histogram, CCI, etc).

Reply With Quote
The following user says Thank You to wccktrader for this post:
 
  #12 (permalink)
Elite Member
Singapore
 
Futures Experience: Intermediate
Platform: NinjaTrader, Sierra Charts
Broker/Data: Thinkorswim, IQFeed
Favorite Futures: Options of SPY, IWM, QQQ
 
wccktrader's Avatar
 
Posts: 47 since Nov 2010
Thanks: 54 given, 141 received

Managed to code the indie to show the correlation between Demand Index and price in the Thinkorswim platform. When the indie drops below 0.4, we have divergences between the Demand Index and price. A possible trading strategy would be trade in the direction of prevailing trend whenever the indie crosses back above 0.4. The Thinkscript code are given below:

#hint:<b>Demand Index</b>\nDeveloped by James Sibbet, the Demand Index is a market strength study that calculates a ratio of buying to selling pressure. It incorporates price and volume to indicate a change in price trend.
#hint length: The number of bars used to calculate the Demand Index. <b>(Default is 5)</b>

declare lower;

input length = 5;

def wClose = (high + low + 2 * close) * 0.25;
def wCRatio = (wClose - wClose[1]) / Min(wClose, wClose[1]);
def closeRatio = 3 * wClose / Average(Highest(High, 2) - Lowest(Low, 2), length) * AbsValue(wCRatio);
def volumeRatio = Volume / Average(Volume, length);
def volumePerClose = volumeRatio / exp(Min(88, closeRatio));
def buyP;
def sellP;
if (wCRatio > 0) {
buyP = volumeRatio;
sellP = volumePerClose;
} else {
buyP = volumePerClose;
sellP = volumeRatio;
}
rec buyPres = if IsNaN(buyPres[1]) then 0 else ((buyPres[1] * (length - 1)) + buyP) / length;
rec sellPres = if IsNaN(sellPres[1]) then 0 else ((sellPres[1] * (length - 1)) + sellP) / length;
def tempDI;
if ((((sellPres[1] * (length - 1)) + sellP) / length - ((buyPres[1] * (length - 1)) + buyP) / length) > 0) {
tempDI = - if (sellPres != 0) then buyPres / sellPres else 1;
} else {
tempDI = if (buyPres != 0) then sellPres / buyPres else 1;
}
def DMIndx = if IsNaN(close) then Double.NaN else if tempDI < 0 then -1 - tempDI else 1 - tempDI;
plot ZeroLine = 0;
plot DivergenceLine = 0.4;

input LookbackPeriod = 20;

plot Corr = correlation(close,DMIndx, LookbackPeriod);

Corr.setDefaultColor(GetColor(1));
ZeroLine.SetDefaultColor(GetColor(5));

DivergenceLine.setDefaultColor(GetColor(2));

Attached Thumbnails
Recreate &quot;Precision Divergence Finder Indicator&quot;?-spy.jpg  
Reply With Quote
The following 2 users say Thank You to wccktrader for this post:
 
  #13 (permalink)
Elite Member
Springfield,Missouri, USA
 
Futures Experience: Advanced
Platform: NinjaTrader (It's a love/hate relationship)
Favorite Futures: CL, TF, 6E
 
Slipknot511's Avatar
 
Posts: 176 since May 2010
Thanks: 60 given, 312 received


Better Momentum for NT7 from Emini-Watch has a divergence indicator built in. If you purchase it, you also get a version that allows you to apply the divergence function to any other indicator of your choosing. For example, you can apply the divergence dots to RSI or Stochastic if that suits you. Pretty reasonable at $170.

Reply With Quote
The following user says Thank You to Slipknot511 for this post:
 
  #14 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


wccktrader View Post
Managed to code the indie to show the correlation between Demand Index and price in the Thinkorswim platform. When the indie drops below 0.4, we have divergences between the Demand Index and price. A possible trading strategy would be trade in the direction of prevailing trend whenever the indie crosses back above 0.4. The Thinkscript code are given below:

Thanks for posting the code. But at first sight I have some difficulty to imagine a trading strategy using this indicator, but then I have no experience with the Demand Index.

Divergences have me gotten in trouble quite often, so I believe that you need additional filters.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #15 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received


Fat Tails View Post
Thanks for posting the code. But at first sight I have some difficulty to imagine a trading strategy using this indicator, but then I have no experience with the Demand Index.

Divergences have me gotten in trouble quite often, so I believe that you need additional filters.

I you don't make sure you are very intimate with divergence produced by your particular indicator, you will loose your shirt... and probably your pants!

Reply With Quote
The following user says Thank You to monpere for this post:
 
  #16 (permalink)
Elite Member
Singapore
 
Futures Experience: Intermediate
Platform: NinjaTrader, Sierra Charts
Broker/Data: Thinkorswim, IQFeed
Favorite Futures: Options of SPY, IWM, QQQ
 
wccktrader's Avatar
 
Posts: 47 since Nov 2010
Thanks: 54 given, 141 received


monpere View Post
I you don't make sure you are very intimate with divergence produced by your particular indicator, you will loose your shirt... and probably your pants!

Thanks monpere. I have just backtested the divergence indicator with another trend following indicator for entry, and exit using an ATR trailing stop indicator. The backtesting results looks good but walk forward analysis results is not good. This confirms that I will loose my shirt trading divergence in real time. Nonetheless, I think divergence may serve as a tool to alert me to have a second look at price actions.

Reply With Quote
 
  #17 (permalink)
Trading for Fun
Europe,Nomad
 
Futures Experience: Intermediate
Platform: Ninja,Jforex,MT4
Broker/Data: DukasCopy,AMP,Alpari,TickMill
Favorite Futures: ES,YM
 
Posts: 85 since Nov 2010
Thanks: 25 given, 30 received

Removed text somebody allready sent info here.

Reply With Quote
 
  #18 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received


wccktrader View Post
Thanks monpere. I have just backtested the divergence indicator with another trend following indicator for entry, and exit using an ATR trailing stop indicator. The backtesting results looks good but walk forward analysis results is not good. This confirms that I will loose my shirt trading divergence in real time. Nonetheless, I think divergence may serve as a tool to alert me to have a second look at price actions.

What do you use to do walk forward testing?

Reply With Quote
 
  #19 (permalink)
Elite Member
Singapore
 
Futures Experience: Intermediate
Platform: NinjaTrader, Sierra Charts
Broker/Data: Thinkorswim, IQFeed
Favorite Futures: Options of SPY, IWM, QQQ
 
wccktrader's Avatar
 
Posts: 47 since Nov 2010
Thanks: 54 given, 141 received


monpere View Post
What do you use to do walk forward testing?

Ninjatrader 7. Optimization with genetic optimizer using 6 months of hourly data and walk forward for the next 6 months.

Reply With Quote
 
  #20 (permalink)
Elite Member
Tonganoxie, Kansas
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: CL,6E
 
gordo's Avatar
 
Posts: 160 since Nov 2009
Thanks: 129 given, 399 received



Fat Tails View Post
The divergence finder is based on the Demand Index by James Sibbet.

As far as I know, there is no version of the Demand Index for NinjaTrader, so the first step would be to code the Demand Index. Below is a link with the code and some explanations.

Re: Sibbet's Demand Index, Omega TradeStation Email Archive | PureBytes.Com

Further information on the Demand Index can be found in.

Robert W. Colby: The Encyclopedia of Technical Market Indicators
Thomas E.Aspray: Fine-Tuning the Demand Index in TASC Vol. 4:4, pp 141-143

V.4:4 (141-143): Fine-tuning the demand index by Thomas E. Aspray

Once you got the Demand Index you need to look for divergences. The divergence finder possibly scans for divergences, using different periods for the Demand Index and then adds them up.

The idea is not bad at all. Divergence stands for a weakening = loss of momentum of a prevailing trend, not yet its reversal. If the trend is weakening across various timeframes a reversal might be imminent.

However, I believe that the indicator also will produce a significant number of false signals, as is usually the case with unfiltered divergences.

I looked at these sites and did a Google search on James Sibbet and Demand Index. The best I could do was find some code developed by eSignal and some in Trader's Laboratory.

I was unable to find any in Ninja. More interesting, I could not find any of James' original work. I did, however, find this same quote in several places:

The Demand Index, developed by James Sibbet, combines price and volume in such a way that it is often a leading indicator of price change. The Demand Index calculations are too complex, however, for this text. The calculations require 21-column accounting paper to calculate manually.
  • There are six "rules" to the Demand Index:
  • A divergence between the Demand Index and the price trend suggests an approaching weakness in price.
  • One more rally to new highs usually follows an extreme peak in the Demand Index (the Index is performing as a leading indicator).
  • Higher prices with a lower Demand Index peak usually coincides with an important top (the Index is performing as a coincidental indicator).
  • The Demand Index penetrates the level of zero indicating a change in trend (the Index is performing as a lagging indicator).
  • When the Demand Index stays near the level of zero for any period of time, a weak price movement that will not last long is indicated.
  • A large long-term divergence between prices and the Demand Index indicates a major top or bottom.
The reason I think everyone is quoting each other is they use the same line:

The Demand Index calculations are too complex, however, for this text. The calculations require 21-column accounting paper to calculate manually.

I'm not sure, but can you even buy 21-column accounting paper anymore?

So although I have this code in Language 'X', I am not sure when I get done moving it to Ninja if I have the right logic. Code isn't worth much if the logic is wrong from the get go.

Anybody have any thoughts on where to find James Sibbet's original logic?

Gordo

Reply With Quote

Reply



futures io > > > Recreate "Precision Divergence Finder Indicator"?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
can anybody code/find the indicator "VOLUMe PRESSURE" from i mystiq NinjaTrader 9 February 19th, 2014 12:32 PM
The VMA Zones indicator. The "Kill Zone"?? Tiberius Traders Hideout 6 October 5th, 2013 09:56 PM
dealing with GetCurrentBidVolume and GetCurrentAskVolume , "long" casting into "int" jmejedi NinjaTrader Programming 4 May 23rd, 2011 10:33 AM
RJay's "Trader Volume" and "Trader Tick" Indicator Suites RJay The Elite Circle 20 December 20th, 2010 06:01 PM
"HiLo of time range" indicator - for Ninja 6.5 ? Eric j NinjaTrader 9 October 5th, 2010 08:14 AM


All times are GMT -4. The time now is 07:50 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-15 in 0.20 seconds with 40 queries on phoenix via your IP 54.163.61.66