# Catch a sharp angle and closer lines in Stochastic Oscillator

Subscribe to signals right in MetaTrader. It is easy!
23
2016.07.24 11:06
Hi guys,

I have a serious problem and I don't think I could handle it myself without any help :(. I would be very grateful if someone could give me even something to read because I don't know where to start...
I'm writing a MQL4 indicator and I stuck on one case. What I need to do, in the first place, you can see it on the picture:

1) First I start from 1 to 2 - Here I need to make a check if the two lines (Stochastic main line(blue) and signal line(pink)) are rising sharply upwards and are as close to each other. The same thing I need to do from 2 to 3 but downwards (sorry about the example I hadn't enough space for the "2" - I hope it is clear what I mean).

2) After that I need to check if there is a sharp angle at 2 (It isn't the sharpest angle in my example, but you can see it in the second picture) - I know it sound ridiculous but it is part of the strategy which I'm trying to implement.

I have two main problems. The first one is that my indicator is dependent on MT4 scale/zoom. For example - if I resize the indicator window my angle gets sharper and my lines closer:

For this case I read that it is better to use "slope" instead of "angle". Am I right?

If I have to be honest with you I have no idea how the hell is possible to catch a sharp angle in Stochastic Oscillator or even to catch an angle, because there might not be one. Is it possible at all? It's easy to do that just with an eye but with MQL4? Is there any relationship with the main chart or with the values of the Stochastic Oscillator which I can use to catch an angle?

My second problem is in some part related with the first one - I think that if i can find some type of relationship I might be able to solve my problem with finding closer lines.

I don't think it's impossible - there is a way... Will it be easy? Nope! Worth it? Absolutely. :)

Thanks!

4732
2016.07.24 12:42

The easiest option should be to check difference between current and previous values.

```double current=iStochastic(...,0);
double previous=iStochastic(...,1);

if(current-previous>10 || current-previous<-10)    //more than 10 percent difference between current and previous
```
23
2016.07.24 14:44
Ernst Van Der Merwe:

The easiest option should be to check difference between current and previous values.

You're talking about catching the angle, right?

I was thinking to do something like that.. but you're right. :) If the Stochastic values goes up in one moment I'll reach the "breakpoint" (the angle) and after that they will start going down. Thanks to this check that you're talking about it will be possible to catch a sharp angle. And furthermore I'm pretty sure that I could catch the closer lines with the same condition... What I'm trying to say is if they're close, their values must also be close.

A huge thanks Ernst Van Der Merwe :)