Divergence detection algorithm
futures io futures trading



Divergence detection algorithm


NinjaTrader

Created April 28th 2010 by cunparis
Updated April 29th 2010 by cunparis
looks_oneFat Tails with 6 posts (11 thanks)
looks_twocunparis with 5 posts (0 thanks)
looks_3max-td with 4 posts (4 thanks)
looks_4shodson with 3 posts (2 thanks)
 
trending_up18,368 views
thumb_up24 thanks given
forum23 replies
attach_file9 attachments



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 100,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
 
Thread Tools Search this Thread
 

Divergence detection algorithm

  #1 (permalink)
Paris, France
 
Trading Experience: Advanced
Platform: Market Delta & Ninjatrader
Favorite Futures: ES
 
cunparis's Avatar
 
Posts: 2,565 since Jun 2009
Thanks: 1,162 given, 2,070 received

Divergence detection algorithm

I've been trying to code a divergence detection but it's really hard. I'm curious if anyone has already tried to do it.

Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on futures io?
Not Trading during Economic Events
EasyLanguage Programming
Drummond Geometry Inquiry
Trading Reviews and Vendors
Select window and then tab that indicator is running on
NinjaTrader
CME Globex | Dynamic Circuit Breakers
Traders Hideout
Paintbar/indicator to Strategy help
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on futures io
ES futures Spoo-nalysis SP500/SPX
237 thanks
Coronavirus COVID-19
155 thanks
Recession? Depression? Bailout!
149 thanks
Is Orderflow An Outdated Concept?
129 thanks
Gold Futures (GC) main discussion
52 thanks
 
  #2 (permalink)
Market Wizard
Berlin, Europe
 
Trading Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,813 since Mar 2010
Thanks: 4,235 given, 26,479 received

There are two indicators available in the NinjaTrader Forum, which you will find below

- D3Spotter
- DivergenceSpotter

For me the problem would not be coding any such indicator, but what to do with it.

Divergence basically is a sort of first derivative, so it indicates a slowdown of price, when a new high or low is made. The danger with following divergences is that it lures you into early countertrades with a rather bad return-to-risk ratio. A triple divergence is a failed divergence, and this occurs frequently. Actually any trending move that leads into a longer congestion will produce a divergence, and usually congestions that follow trending moves are continuation patterns.

A three-push pattern usually produces a triple divergence, if it is a wedge. If the last high or low overshoots the opposite trendline to stop at one of the fibonacci ratios, you might take that trade without a prior trendline break.

Otherwise, I only use a signal that creates a divergence within a divergence, that means a smaller timeframe divergence within a larger timeframe divergence, if a clear trendline break in the larger timeframe has already occured.

Attached Files
Register to download File Type: zip DivergenceSpotter.zip (28.4 KB, 340 views)
Register to download File Type: zip D3Spotter.zip (18.0 KB, 251 views)

Last edited by Fat Tails; April 28th, 2010 at 04:40 PM. Reason: missing word added
Reply With Quote
The following 8 users say Thank You to Fat Tails for this post:
 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Futures: SPX, Emini Futures
 
Big Mike's Avatar
 
Posts: 48,211 since Jun 2009
Thanks: 30,803 given, 92,211 received



cunparis View Post
I've been trying to code a divergence detection but it's really hard. I'm curious if anyone has already tried to do it.

You'll need to be more specific.

It can be as simple as:

 
Code
                            


myema 
XAverage(C20);
mycci CCI(14);

if 
myema myema[1] and mycci mycci[1then divergence true
etc. Then just draw the trendline, init it first then track the ID, and then extend it each bar the divergence continues. TL_New_self for tl's in panel 2, or if you want it on price panel just use TL_New.

It will all depend on what you call divergence.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member (see why)

Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
Paris, France
 
Trading Experience: Advanced
Platform: Market Delta & Ninjatrader
Favorite Futures: ES
 
cunparis's Avatar
 
Posts: 2,565 since Jun 2009
Thanks: 1,162 given, 2,070 received


Big Mike View Post
It will all depend on what you call divergence.

YOu're right, I should have been more specific.

I'm looking for one data series to make a HH and another to make a LH. I'd like the HH to be relatively close to the previous H, meaning the HH must be a consecutive peak. I don't want them to have smaller highs in between because that gets really complicated.

I started approaching it just from a pattern perspective. 3 bar pattern, 4 bars, 5 bars but it gets complicated cause there are different possibilities when you get to 5 for the bars in between.

I'm wondering if I should continue that or if there is a better way.

I don't really like the moving average approach, I want the divergence on the raw data and since it can be 3 bars I can't have any lag.

Follow me on Twitter Reply With Quote
 
  #5 (permalink)
Paris, France
 
Trading Experience: Advanced
Platform: Market Delta & Ninjatrader
Favorite Futures: ES
 
cunparis's Avatar
 
Posts: 2,565 since Jun 2009
Thanks: 1,162 given, 2,070 received


Fat Tails View Post
For me the problem would not be coding any such indicator, but what to with it.

Divergence basically is a sort of first derivative, so it indicates a slowdown of price, when a new high or low is made. The danger with following divergences is that it lures you into early countertrades with a rather bad return-to-risk ratio.

Who said anything about price???

I agree entering based on a divergence is not a good idea. For me it's just another piece of the puzzle. Gives me a warm fuzzy.

I'll look at those indicators. now I feel stupid cause I searched the forum discussions but I didn't think of searching the file downloads. it'd be nice if the forum search did both.

Thanks

Follow me on Twitter Reply With Quote
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Futures: SPX, Emini Futures
 
Big Mike's Avatar
 
Posts: 48,211 since Jun 2009
Thanks: 30,803 given, 92,211 received


cunparis View Post
I don't really like the moving average approach, I want the divergence on the raw data and since it can be 3 bars I can't have any lag.

Good luck

I would suggest using Alexander ZigZag or similar, but there is always lag in detection of the formation of the new zigzag.

If you are looking for a breakout or breakdown of a prior HH or LL, you'll first have to have a working method for identifying those HH and LL's (ZigZag for instance, or your own).

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member (see why)

Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
 
  #7 (permalink)
the coin hunter
virginia
 
Trading Experience: Intermediate
Platform: ninja
Favorite Futures: NQ
 
cory's Avatar
 
Posts: 5,968 since Jun 2009
Thanks: 826 given, 7,756 received

also take a look at ninja candle finder indicator they use a strength value to filter out some weak divergence (weak trend).

ps. if you are in looking for some new idea here is one;

This review is for: Value in Time: Better Trading through Effective Volume (Wiley Trading) (Hardcover)

The author uses inexpensive off-the-shelf software to slice each trading day of a stock into one-minute segments. He finds the average one-minute volume for the day and separates the minutes into those with above or below average volume. In each group, he adds up the volume of minutes with rising prices and subtracts the volume of minutes with falling prices. This gives him two cumulative volume lines: one for the minutes with above average and the other for below average volume. He named them Large and Small Effective Volume.

The minutes with above average volume reflect the impact of the big money and often have predictive value. When you find a condition in which the big money starts pushing up a stock, while the small money remains negative or neutral, an upside reversal is in the cards. When the big money starts pushing the stock down while the small money is flat or buying, a downside reversal is more likely.

Reply With Quote
The following 5 users say Thank You to cory for this post:
 
  #8 (permalink)
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 923 received

hi cunparis,
i also looked for a good diver-indie some weeks ago.

i found interesting + good working ones for MT4 but havent translated them - thats far below of my skills.
but what they show looks like a clear + sensemaking definition + calculation.

let me know if you are interested that i post / send you / the MT4 scripts to have a look at it.

-

max-td
Reply With Quote
 
  #9 (permalink)
Paris, France
 
Trading Experience: Advanced
Platform: Market Delta & Ninjatrader
Favorite Futures: ES
 
cunparis's Avatar
 
Posts: 2,565 since Jun 2009
Thanks: 1,162 given, 2,070 received


max-td View Post
hi cunparis,
i also looked for a good diver-indie some weeks ago.

i found interesting + good working ones for MT4 but havent translated them - thats far below of my skills.
but what they show looks like a clear + sensemaking definition + calculation.

let me know if you are interested that i post / send you / the MT4 scripts to have a look at it.

-

I haven't seen MT4's code so i don't know what it looks like but if you have a few examples of the indicator on a chart that would help to see how it works and then I could look at the code to see if I can translate it to easylanguage or C#.

Follow me on Twitter Reply With Quote
 
  #10 (permalink)
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 923 received


there we go ....
pic is from this morning
divers are made with MacD in this example.
the code is in MT4.
folks say MT4 code is very near to NT-script - so its no complete other world.


it show "normal + hidden" diver as solid + dashed lines.

in realtime it works great - there is no repaint + nothing "evil" in it

the arrows /signals come up with the FIRST Bar that shows a turning MacD -- not 3 Bars later or so ! so its realy useful and not just "nice in review" like so much other things.

have a look at it if you can extract the calculations - i would love to see this for NT !


BTW -- you get MT4 incl feeds for free at alpari for example .... or at any forexbrokers

max-td
Attached Thumbnails
Divergence detection algorithm-mt4-diver20100429-fiic-261kb.jpg  
Attached Files
Register to download File Type: zip MACD_Divergence_V1.1.zip (2.1 KB, 194 views)
Reply With Quote
The following 3 users say Thank You to max-td for this post:

Reply



futures io Trading Community Platforms and Indicators NinjaTrader > Divergence detection algorithm




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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Social Media Predictive Data for Traders w/Joe Gits @ SMA [and Lime Brokerage]

Apr 9
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this Bullish Divergence? prisonbreaker82 Traders Hideout 3 February 10th, 2011 02:02 PM
Range Market Detection sysot1t Traders Hideout 1 October 10th, 2010 06:05 AM
Trading Divergence shodson Traders Hideout 17 May 5th, 2010 08:42 PM
volume divergence Jeff Castille NinjaTrader 4 January 10th, 2010 02:49 AM
Divergence sefstrat The Elite Circle 6 September 21st, 2009 08:37 PM


All times are GMT -4. The time now is 08:40 AM. (this page content is cached, log in for real-time version)

Copyright © 2020 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