Stochastic Indicators when lines crossing

Created at 28 Mar 2018, 18:21
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
KA

Kaworu

Joined 10.11.2014

Stochastic Indicators when lines crossing
28 Mar 2018, 18:21


Can somebody help me with this indicator? I need to know the syntax on when the K line crosses the D line when it's below 30.

 

TIA


@Kaworu
Replies

PanagiotisCharalampous
29 Mar 2018, 09:40

Hi Kaworu,

Let's suppose you have a Stochastic Oscillator

private StochasticOscillator _so;

You can a check like the below

_so.PercentK.HasCrossedBelow(_so.PercentD,1);

If you want to check the last value of the D line, then you can use the following property

_so.PercentD.LastValue

Let me know if the above is helpful.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Kaworu
29 Mar 2018, 18:23

in the periods parameter of HasCrossedBelow, why should it be 1 instead of the periods of K?


@Kaworu

PanagiotisCharalampous
30 Mar 2018, 09:37

Hi Kaworu,

This is just a sample. 1 represents the number of periods for which the check will take place. You can put any number you want.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Kaworu
30 Mar 2018, 19:12

im not getting the correct results from my simulation and it still takes a trade well below the 20 line of the indicator regardless of what value i put in it.

which method should i use in order for me to check the current value of the lines inside the indicator? not the current price of the symbol but the value inside indicator?

what im trying to accomplish is i need to check if the lines are below 20 in the Stochastic Indicator and when the D line crossed aboved the K line.

thanks for your help so far


@Kaworu

PanagiotisCharalampous
02 Apr 2018, 09:10

Hi Kaworu,

which method should i use in order for me to check the current value of the lines inside the indicator? not the current price of the symbol but the value inside indicator?

You can use the LastValue property of each IndicatorDataSeries.

Best Regards,

Panagiotis


@PanagiotisCharalampous