Robert
418
Robert  

Hi Miss...

Mladen's explanation is exactly how divergences work... They need clearly defined "peaks or troughs"...which requires them to be confirmed on (normally) two bars back.

However...you seem to have some interesting ideas you want to test with divergences...so here is what I have...

You CAN set the divergences to the current bar....BUT...you WILL get a number false positives...as the peaks and troughs continue to change with a new high or new low until they are finally confirmed.

While that being said...there may be some value in using this as a "heads up" of the real divergences to come...and then use that in conjunction with other indicators to get your final signal.

Here is how to set the divergences for the "current bar" on any divergence indicator...

It assumes you have the .mt4 source file to change the code.

Find the divergence drawing routines and find the "i+2" loops and change them to "i+1" (one bar back) or "i+0" (current bar)...and you will get your divergences shown on those bars...

Please see the attached example showing the multiple divergence lines on my Stoch Divergence indicator...set to Current Bar 0...

I am curious as to what your interest/strategy is...for why you want this method to see divergences...?

I hope this helps you,

Robert

samuelkanu
164
samuelkanu  
mladen:
samuelkanu Set the alertsOn parameter to true and it will work (additionally adjust the rest of the parameters that are alerts related). It works just as it should. See the example

Mladen why is it that that if i set the alarm to alert on current to true it does not trigger but if i set it to false it works?

Mladen Rakic
200724
Mladen Rakic  
samuelkanu:
Mladen why is it that that if i set the alarm to alert on current to true it does not trigger but if i set it to false it works?

samuelkanu

That indicator should be rewritten )it uses 1 future bar in calculation, and that is probably the reason for that)

Miss
17
Miss  
cosmiclifeform:
Hi Miss...

Mladen's explanation is exactly how divergences work... They need clearly defined "peaks or troughs"...which requires them to be confirmed on (normally) two bars back.

However...you seem to have some interesting ideas you want to test with divergences...so here is what I have...

You CAN set the divergences to the current bar....BUT...you WILL get a number false positives...as the peaks and troughs continue to change with a new high or new low until they are finally confirmed.

While that being said...there may be some value in using this as a "heads up" of the real divergences to come...and then use that in conjunction with other indicators to get your final signal.

Here is how to set the divergences for the "current bar" on any divergence indicator...

It assumes you have the .mt4 source file to change the code.

Find the divergence drawing routines and find the "i+2" loops and change them to "i+1" (one bar back) or "i+0" (current bar)...and you will get your divergences shown on those bars...

Please see the attached example showing the multiple divergence lines on my Stoch Divergence indicator...set to Current Bar 0...

I am curious as to what your interest/strategy is...for why you want this method to see divergences...?

I hope this helps you,

Robert

Hi Robert,

Very well explained . But which part of the source file that I need to change ? Do you mean this one?void CalculateIndicator(int countedBars)

{

for(int i = Bars - countedBars; i >= 0; i--)

{

CalculateOsMA(i);

CatchBullishDivergence(i + 2);

CatchBearishDivergence(i + 2);

}

}

Attached here are osmadivergence_alerts.ex4osmadivergence_alerts.mq4

Robert
418
Robert  

Hi Miss,

Yes exactly... You found it on the first try... Good for you.

You can also change it without re-doing the code each time...by adding a variable name as an "extern"...and using that in the place of the bar number.

Example:

At the top in user settings....add...extern int BarNum = 0; // 0 = current bar

Then in the functions below - change the (i+2) to....(i+BarNum)....

That way you can change the user settings real time and immediately see the differences depending on which bar it is set on...

Hope this helps you,

Robert

dmnik
132
dmnik  

Dear mrtools and Mladen !

Please help I need to remove a notice on the little arrows and leave at large on the green and red. And add the white balls to buy and sell. Thank you!

Files:
.......png 72 kb
fiji.rar 16 kb
William Snyder
9549
William Snyder  
DMNIK:
Dear mrtools and Mladen ! Please help I need to remove a notice on the little arrows and leave at large on the green and red. And add the white balls to buy and sell. Thank you!

Hello DMNIK,

Having trouble understanding exactly what your looking for.

alvinkon
69
alvinkon  

Dear Mladen,

Can help to convert and attached indicator to use on new metatrader? And is it possible help to add Push Notification also?

Thank you.

emmany4
130
emmany4  

Hello MrTools and Mladen, thanks for doing a wonderful job on this forum. Pls i need ur help in making this indicator to alert sound and popup alert messages including the pair names even though it seems to have these functions in built.

Thanks in advance.

emmany4
130
emmany4  

Pls, also with option on alert on candle close or on current candle.Thanks in advance.

emmany4:
Hello MrTools and Mladen, thanks for doing a wonderful job on this forum. Pls i need ur help in making this indicator to alert sound and popup alert messages including the pair names even though it seems to have these functions in built. Thanks in advance.