MQL4 - automated forex trading   /  

Code Base

ODL Securities

Code Base  Indicators  FX5_Divergence To post a new code, please log in or register

This library is for
MetaTrader 4
Download MT 4 - 3.5 Mb

Mobile trading!
Buy a license and be mobile in your trading!

Name:
FX5_Divergence
Author: FX5 (2007.06.05 13:54)
Rating: 7.6
Downloaded: 8759
Download:
 FX5_Divergence_V2.0.mq4 (12.2 Kb) View
 FX5_Divergence_v1.5.mq4 (14.6 Kb) View
 FX5_Divergence_v1.1.mq4 (12.6 Kb) View
 FX5_Divergence_V2.1.mq4 (11.3 Kb) View

Divergence is a powerful tool for detecting price reversal points from support and resistance zones. It usually gives us a relatively early signals compared to those given by moving average indicators. It can be successfully applied to many technical indicators and end up with good results.


This indicator will plot divergence lines between the price and OsMA indicator. It will give buy/sell signal according to the type of divergence that was detected. The indicator also is capable of drawing divergence lines for the whole history prices located within a specific chart.


Bullish divergence will be plotted with green lines on both price and OsMA idicator windows.


Bearish divergence will be plotted with red lines on both price and OsMA idicator windows.

 

I hope this indicator prove to be a useful tool.


Changes to Version 1.5:

  • A bug was fixed in updating divergence lines as the live quotes flow;
  • A sound Alert feature was added to the indicator and can be enabled or disabled from indicator settings;
  • Classical divergence is plotted in Solid Style (continues) lines, while hidden divergence is plotted in Dot Style (interuppted) lines.

Changes to version 2.0:

  • The code was rebuilt from scratch to make the indicator runs much faster.
  • The indicator now doesn't repaint any of its signals.
  • Some improvements in the signal identification algorithms.

Version 2.1:

  • I attached the last file by mistake. This is the one I wanted to attach. It is the last version. I am designating it version 2.1.

 

34 comments: 1 2 3 4   To post a new comment, please log in or register

Hi, FX5.

I can suggest some cosmetic code changes. I think, this may make code a little more readable.

1. In deinit()

change

       if(StringSubstr(label, 0, 14) != "DivergenceLine")
           continue;
       ObjectDelete(label);
to
       if(StringSubstr(label, 0, 14) == "DivergenceLine")
           ObjectDelete(label);


2. In IsIndicatorPeak()

change

           if(OsMA[i] > OsMA[shift])
              break;
to
           if(OsMA[i] > OsMA[shift])
              return(false);
(and so in IsIndicatorTrough()).


14.08.2008 12:57 Sajan

HI FX5

Nice and very good Indicator. can you make the same idea for Indicators  Stochastic Momentum and Rsi ?

it will be very powerful maybe in one window?

any way

thank for this one

10.07.2008 20:38 StarLight
Can you make the arrow appear in real time? not like the last bar behind it.
28.05.2008 12:03 Togu
I have questions. I've installed the latest fx5 divergence indicators one that repaints and one that doesn't but I happen to miss the signal all the time. Does the arrow appear after one bar has already closed?

i wanted to SELL on one signal but it appears it only showed just after openning another bar I've been monitoring last couple of hours and now I see the arrow. It seems like I'm very late at least one bar or two. Does any1 misses the arrow? Because I've been thinking to sell on a signal right after the arrow bar closes.
28.05.2008 12:02 Togu

FX5,

 

Could you possibly help by putting the Sendmail function into the indicator for when there is a signal? I tried but my coding ability is less than optimal !! Great indicator....using it to make nice $$$ in futures markets!!!! Maybe a quick explanation of how/when this indicator works? Thanks for sharing your work!!

Daniel

26.03.2008 19:59 forexman05
is there a chance you could create a code that gives the arrow on the close of the divergence candle.  I find when using this with other indicators it creates some great opportunities
14.11.2007 03:41 whb1949
FX5 wrote:
Zulu wrote:
The signal apears not on the last candle, but on the preavious candle, so it's REPAINT the ONE VERY IMPORTANT CANDLE. Please make a divergence without the comfirmative candle.

more power to you FX5

Hello Zulu,

The last version doesn't repaint any of the signals, however the signal is delyed one candle so it can be verified. Divergence is not an immidiate signal. It just tells us that the trend is about to reverse and we shouldn't enter untill we see evidance on this reversal, and that is why I delayed the signal in the final version.


14.11.2007 03:40 whb1949
GSB wrote:
Hello.
Excellent Idicator.
But the Divergence generally calculated on the specified time.
Otherwise the Indicator displays false signals sometimes.
Please, add the interval at the code (as parametr) for looking-for the divergense.

Best regards.

14.11.2007 03:39 whb1949
Hello.
Excellent Idicator.
But the Divergence generally calculated on the specified time.
Otherwise the Indicator displays false signals sometimes.
Please, add the interval at the code (as parametr) for looking-for the divergense.

Best regards.
29.07.2007 01:29 GSB

hi

could you make a divergence indicator stohastic 14,3,3 ?i think its better than osma divergence..

than you

12.07.2007 01:43 zioncity