Re: MT5 Stochastic indicators

51
Hello Banzai,
Many years ago, a programmer friend of mine named GIO translated my divergence code for Metastock into MT5. I had thought about forming divergences by counting the number of bars up to a maximum of 9, but the best divergences form between 3, 4, and 5 bars.
Now, after so many years, I would like to make the following changes:
1) add the condition that, for a positive divergence, the Stochastic is ABOVE its 6 simple moving average, and that for a negative divergence, the Stochastic is BELOW its 6 simple moving average.
2) I would like a push notification to occur when this particular divergence appears.
3) I would like a push notification to occur when the bar following the divergence is inside (in this case, the movement is even more violent).
4) The cusp must also appear on the inside bar.

My Metastock code for divergence followed by an inside bar is on lines 159 and 163.

I attach 2 example images

I will put my formula in 3D too
mt4-divergence-indicators-list-how-good ... 97-90.html
These users thanked the author uradello for the post (total 2):
Banzai, Jimmy
Rating: 1.2%


Re: MT5 Stochastic indicators

53
temporalmotif wrote: Wed Jan 07, 2026 11:12 pm @Mrtools
Hope you are doing well!
I forgot to mention for this indicator are you able to add a buy and sell color slope label under the color section for "signal" in the indicator.
Also can the divergence be catered for the signal line instead of the stochastic line mentioned above.
Originally you created this beautiful indicator
Kindest Regards
--Divergence is undoubtedly one of the most stunning inventions in the trading world! It helps you accurately capture market turning points and effortlessly lock in profits right at the tops and bottoms—as if you’ve got the market’s pulse in your hands💃
--That said, some traditional indicators are always chasing that illusory “certainty”. Admittedly, they shine brightly in frenzied bull or bear markets—but let’s be real, who can truly predict the market’s direction before it actually kicks off? The moment we hit ranging markets, these indicators fail miserably. They’ll have you selling at rock bottom and buying at sky-high prices, and it’s just heartbreaking to watch your trading capital shrink away💔
--This is exactly why divergence is so fascinating! It’s like an elegant dancer, hinting at trend reversals through the subtle discrepancies between price action and indicators.. plenty of veteran traders are diving deep into research on this, their efforts are significant and far-reaching. ✨
--I sincerely hope all you trading gurus out there will keep digging deeper into the treasure trove of divergence. When I stumbled upon the [Stochastic color (mtf + divergence).ex5] indicator today, my eyes lit up immediately—it’s like a delicate key that unlocks brand-new possibilities in trading! If it could be further polished and optimized, it would be absolutely perfect🎉

Re: MT5 Stochastic indicators

54
uradello wrote: Tue Jan 13, 2026 3:18 am P.S. Sometimes the average is 9 periods long...
I hope someone will kindly make the changes above. Thanks in advance.
I don't understand anything about MT4/MT5 language but in metastock it's very simple...on line 84 my string appears regarding the first 2-bar divergence:

LINE 70 : I define my stochastic and call it

Code: Select all

STOC5....STOC5=STOCHK(C,5,3); 
NEW: I define the simple moving average at 6 and 9 of the stochastic:

Code: Select all

MOV (STOCK(5,3),6,S)   MOV (STOCK(5,3),9,S)

Code: Select all

line 84 : DIV2BUY=L=LLV(L,10) AND STOC5>=STOC5[2] AND STOC5[1]>STOC5[2]
 AND STOC5[2]<25 AND L[2]<L[3] AND L[1]>L[2] AND L<L[2] AND H[1]>H[2]
...and here is the change I'm asking for....and

Code: Select all

STOC55>=MOV (STOCK(5,3),6,S) OR STOC55>=MOV (STOCK(5,3),9,S)
...THAT'S ALL

This change must also be implemented for the lines of code 87..91..95...and obviously the opposite is true for sell divergences.
For any other explanation, just ask me

Re: MT5 Stochastic indicators

55
uradello wrote: Fri Jan 16, 2026 7:13 pm I don't understand anything about MT4/MT5 language but in metastock it's very simple...on line 84 my string appears regarding the first 2-bar divergence:

LINE 70 : I define my stochastic and call it

Code: Select all

STOC5....STOC5=STOCHK(C,5,3); 
NEW: I define the simple moving average at 6 and 9 of the stochastic:

Code: Select all

MOV (STOCK(5,3),6,S)   MOV (STOCK(5,3),9,S)

Code: Select all

line 84 : DIV2BUY=L=LLV(L,10) AND STOC5>=STOC5[2] AND STOC5[1]>STOC5[2]
 AND STOC5[2]<25 AND L[2]<L[3] AND L[1]>L[2] AND L<L[2] AND H[1]>H[2]
...and here is the change I'm asking for....and

Code: Select all

STOC55>=MOV (STOCK(5,3),6,S) OR STOC55>=MOV (STOCK(5,3),9,S)
...THAT'S ALL

This change must also be implemented for the lines of code 87..91..95...and obviously the opposite is true for sell divergences.
For any other explanation, just ask me
Can we see a picture of this unique Stochastic you have in Metastock?