Divergence detection algorithm - NinjaTrader Programming | futures io social day trading
futures io futures trading


Divergence detection algorithm
Updated: Views / Replies:14,203 / 24
Created: by cunparis Attachments:9

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

Divergence detection algorithm

  #11 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 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, 172 views)
Reply With Quote
The following 3 users say Thank You to max-td for this post:
 
  #12 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received

Thanks Cunparis for the thread idea and max-td for the mt4 code. I'm wondering if anyone has compared the MT4 code with the Spotter codes posted by Fattails?

Or has anyone done some successful porting from MT4 to NT? I'd be willing to give it a try but I'm looking for resources to understand things like this one:

 
Code
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
for(int i = ObjectsTotal() - 1; i >= 0; i--)
{
string label = ObjectName(i);
if(StringSubstr(label, 0, 19) != "MACD_DivergenceLine")
continue;
ObjectDelete(label); 
}
return(0);
}
in other words, how is "de" initialization compared to NT initialization? If anyone has some online tutorials for porting, please post links.
Thanks,
kz

Reply With Quote
The following user says Thank You to zeller4 for this post:
 
  #13 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


hi zeller!

have a look here - its infos about the D3-spotter - D3 didnt really look for divers/swings in the indicator at all but manages the line-plotting not too bad i think.

https://futures.io/traders-hideout/2415-quick-question-about-d3spotter-indicator.html

about the other one i know not much - but it did not give out such good+clear results/signals like the MT4-indis

max-td
Reply With Quote
The following user says Thank You to max-td for this post:
 
  #14 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received

Thanks, Max,

I noticed while going through an NT support thread that sefstrat and eDanny seem to have an excellent handle on converting MT4 indicators.

If they would be so kind to teach us "junior programmers" how to port MT4, that would be greatly appreciated.

kz

Reply With Quote
 
  #15 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,255 received

Some time ago I started working with a couple of guys that wanted a strategy to enter a trade when we get MACD divergence off a Bollinger Band bounce. I annotated some charts to help clarify what they were looking for. See attached.

The trick is when to take the 1st peak, and when to start looking for a second but divergent peak in both data series. For example, in the MACD examples, after the first peak in the histogram, we decided to not start looking for a new but higher swing low in the MACD histogram unless the MACD unless we got at least 3 higher readings after the first peak. Some thought we should cross all the way above the zero line and then back below it before waiting for the 2nd swing lower,while others thought that a cross above the zero line should reset the search for a 2nd peak. Also, regarding price, it wasn't clear if we are comparing lower lows or lower closes.

So there is a lot of discretion in measuring divergence and how you read the 2 data series that you are comparing. These examples that I share are some of the challenges one has to consider.

Attached Thumbnails
Divergence detection algorithm-macd-divergence.png   Divergence detection algorithm-macd-divergence2.png  
Reply With Quote
The following user says Thank You to shodson for this post:
 
  #16 (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,601 received
Forum Reputation: Legendary

Most trading systems based on divergences have a negative expectancy. The left chart is a good example. MACD produced a divergence, not because the trend slowed down, but because of the Baskerville effect: a moving average also barks if something drops out at the beginning of the period.

By pure luck price entered a consolidation and then continued its prior trend. Every short term consolidation of a trend produces a divergence, so you would not want to trade all of them.

The right chart shows that a trade entry based on MACD divergence came way too early. What about adding a filter that you will only take divergences after a trendline break ?

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #17 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,255 received


Fat Tails View Post
Most trading systems based on divergences have a negative expectancy. The left chart is a good example. MACD produced a divergence, not because the trend slowed down, but because of the Baskerville effect: a moving average also barks if something drops out at the beginning of the period.

By pure luck price entered a consolidation and then continued its prior trend. Every short term consolidation of a trend produces a divergence, so you would not want to trade all of them.

The right chart shows that a trade entry based on MACD divergence came way too early. What about adding a filter that you will only take divergences after a trendline break ?

Which is why I think the requirement that the divergence occur happen off of a Bollinger band bounce potentially increases the success of reversal.

Reply With Quote
The following user says Thank You to shodson for this post:
 
  #18 (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,601 received
Forum Reputation: Legendary

If you have a strong trend, this will be typically near a Bollinger Band. I have often observed that a trend weakens - i.e. reduces its slope - several times before it reverses. See daily chart of ES below.

Attached Thumbnails
Divergence detection algorithm-bollinger-band.jpg  
Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #19 (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,601 received
Forum Reputation: Legendary

Or let us have a look at price action of ES during the last hour:

Attached Thumbnails
Divergence detection algorithm-es-06-10-5-min-29_04_2010-bis.jpg  
Reply With Quote
 
  #20 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,255 received



Fat Tails View Post
If you have a strong trend, this will be typically near a Bollinger Band. I have often observed that a trend weakens - i.e. reduces its slope - several times before it reverses. See daily chart of ES below.

I attached an updated chart with notes...

Also, reversals often can have targets 2-6x larger than stops so you don't need to be right more than 50% of the time.

Attached Thumbnails
Divergence detection algorithm-divergence-detection-algorithm-bollinger-band.jpg  
Reply With Quote

Reply



futures io > > > > > Divergence detection algorithm

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
Is this Bullish Divergence? prisonbreaker82 Traders Hideout 4 February 10th, 2011 03:02 PM
Range Market Detection sysot1t Traders Hideout 2 October 10th, 2010 07:05 AM
Trading Divergence shodson Traders Hideout 17 May 5th, 2010 09:42 PM
volume divergence Jeff Castille NinjaTrader Programming 4 January 10th, 2010 03:49 AM
Divergence sefstrat The Elite Circle 6 September 21st, 2009 09:37 PM


All times are GMT -4. The time now is 10:20 AM.

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.14 seconds with 20 queries on phoenix via your IP 54.221.76.68