MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2007.06.14 09:29
FX5_MACD_Divergence

FX5_MACD_Divergence - indicator for MetaTrader 4

| English Spanish Portuguese

Views:
64214
Rating:
votes: 9
Files:


After the success of the original indicator, I decided to write more indicators for detecting divergence between price and other indicator.



This indicator will plot divergence lines on the MACD indicator and will give buy and sell signal by displaying green and red arrows. It also has a built-in alert function. As the original indicator, bullish divergence is plotted in green lines while bearish divergence is plotted in red. If the divergence is classic the line will be solid and if the type is reversed the line will be interrupted.



I hope you gets the most benedfit from this indicator.

Changes to verion 1.1:

- This version is directed to traders who do not want repainted singals. The signals are not repainted buy they are delayed one candle.

Last comments | Go to discussion (40)
glorenz75
glorenz75 | 4 Jul 2013 at 07:41
glorenz75:

Hi! 

I am trying to build an EA based on this indicator and others, but I am honestly a newbie in programming. I have difficulty in creating the trigger to open a correct buy / sell order when the signal is given by this indicator. I was assuming that bullish divergence signal is geven when the value of buffer #0 is ddifferent from 0. but in this case orders happen to be done in every bar. this is how I am going to check for the signal... can you help me to understand where I am wrong? Looking at the data Window this should be correct!

   IF (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,1) != 0) 

 

Lorenz 

I also tried with .... != EMPTY_VALUE ... but it catches only some of the signals! I do not understand why. 
hxsandhx
hxsandhx | 30 Jul 2013 at 03:06
glorenz75:
glorenz75:

Hi!

I am trying to build an EA based on this indicator and others, but I am honestly a newbie in programming. I have difficulty in creating the trigger to open a correct buy / sell order when the signal is given by this indicator. I was assuming that bullish divergence signal is geven when the value of buffer #0 is ddifferent from 0. but in this case orders happen to be done in every bar. this is how I am going to check for the signal... can you help me to understand where I am wrong? Looking at the data Window this should be correct!

IF (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,1) != 0)

Lorenz

I also tried with .... != EMPTY_VALUE ... but it catches only some of the signals! I do not understand why.

value1=iCustom(Symbol(),Period(),"FX5_MACD_Divergence_V1.1",

separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,2);

value2=iCustom(Symbol(),Period(),"FX5_MACD_Divergence_V1.1",

separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,1,2);

if(value1<100) ordersend(buy);

if(value2<100) ordersend(sell);


MQL4 Comments
mql4_comments | 14 Oct 2013 at 06:54
igsnowhawk:
glorenz75:


value1=iCustom(Symbol(),Period(),"FX5_MACD_Divergence_V1.1",

separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,2);

value2=iCustom(Symbol(),Period(),"FX5_MACD_Divergence_V1.1",

separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,1,2);

if(value1<100) ordersend(buy);

if(value2<100) ordersend(sell);


Woud it be possible for the custom indicator to return if its classical/reverse divergence, be it bullish/bearish? I have logged out value1 and value2 to observe the pattern and it does not seem to show any consistent patterns that are able to identify if the divergence is classical or reverse...any enlightenment is highly appreciated?
dannyag
dannyag | 1 Nov 2013 at 18:36

Thanks a million for your efforts, brilliant idea.

MQL4 Comments
mql4_comments | 15 Nov 2013 at 07:39
Please create for On balance volume Divergence