Stochastic IsRising

Created at 25 May 2020, 09:08
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!
VE

velu130486

Joined 08.11.2019 Blocked

Stochastic IsRising
25 May 2020, 09:08


Dear All,

I found a Cbot in this forum which has a coding as below.

double kClose = stoDi.Result.Last(1);
double kPreviousClose = stoDi.Result.Last(2);
bool isRisingK = stoDi.Result.IsRising();
bool isFallingK = stoDi.Result.IsFalling();
double dClose = stoDi.Signal.Last(1);
double dPreviousClose = stoDi.Signal.Last(2);
bool isRisingD = stoDi.Signal.IsRising();
bool isFallingD = stoDi.Signal.IsFalling();
if (kClose > kPreviousClose && isRisingK && dClose > dPreviousClose && isRisingD)

Please advice me what is the difference between "kClose > kPreviousClose && isRisingK", (i.e.) How it checks the values and which 1 is better

Also I found another Bot which has a condition

if (i_MA_fast.Result.HasCrossedBelow(i_MA_slow.Result.LastValue, param_ma_cross_period))

What I understood is it is checking the Fast MA is crossed below slow MA, but I could not understand the function MA cross period. What I have to input to check the MA crossed or not.

Thanks and Regards

R. Vadivelan


Replies

PanagiotisCharalampous
25 May 2020, 12:50

Hi there,

1. There is no difference between kClose > kPreviousClose and isRisingK

2. The period in HasCrossedBelow() indicates how many periods backwards does the method needs to check for a crossover.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

velu130486
25 May 2020, 14:57

RE:

Hi Panagiotis,

Thanks for your reply. That means I no need to use both kClose > kPreviousClose and isRisingK in the Cbot, I can use any one right.

For the the CrossedBelow(), if I input 10 means it will check for last 10 candles to check the crossover is happened or not, if the crossover not happened in last 10 bars means no signal is generated right

Thanks and Regards

R. Vadivelan

PanagiotisCharalampous said:

Hi there,

1. There is no difference between kClose > kPreviousClose and isRisingK

2. The period in HasCrossedBelow() indicates how many periods backwards does the method needs to check for a crossover.

Best Regards,

Panagiotis 

Join us on Telegram

 

 


PanagiotisCharalampous
25 May 2020, 14:59

Hi Vadivelan,

Yes this is correct.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

velu130486
25 May 2020, 15:01

RE:

Hi Panagiotis,

Thanks for your quick reply. Now its clear.

PanagiotisCharalampous said:

Hi Vadivelan,

Yes this is correct.

Best Regards,

Panagiotis 

Join us on Telegram

 


velu130486
02 Jun 2020, 08:43

RE:

Hi Panagiotis,

If I use IsRisingK/IsFallingK in my Cbot Code, the value will be checks on Ticks() or On Bars. If I want to check the value on Bars means how I can use the Code.

Is there any function available to check STO %D has crossed above %K same like EMA?

Thanks and Regards

R. Vadivelan

PanagiotisCharalampous said:

Hi there,

1. There is no difference between kClose > kPreviousClose and isRisingK

2. The period in HasCrossedBelow() indicates how many periods backwards does the method needs to check for a crossover.

Best Regards,

Panagiotis 

Join us on Telegram

 

 


PanagiotisCharalampous
02 Jun 2020, 08:49

Hi Vadivelan,

It is your decision where the check will take place, in OnTick() or in OnBar(). To check crosses, you can use HasCrossedAbove() and HasCrossedBelow() methods.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

velu130486
02 Jun 2020, 08:58

RE:

Hi Panagiotis,

Thanks for your reply. HasCrossedAbove() will also work for Stochastic Indicator, Could you please share me the sample coding to check whether it has crossed above or not?

Thanks and Regards

R. Vadivelan

PanagiotisCharalampous said:

Hi Vadivelan,

It is your decision where the check will take place, in OnTick() or in OnBar(). To check crosses, you can use HasCrossedAbove() and HasCrossedBelow() methods.

Best Regards,

Panagiotis 

Join us on Telegram

 


PanagiotisCharalampous
02 Jun 2020, 09:05

Hi Vadivelan,

Here it is

            if (_stoch.PercentD.HasCrossedAbove(_stoch.PercentK, 0))
            {
                // Do something
            }

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

velu130486
02 Jun 2020, 09:10

RE:

Thanks Panagiotis for quick reply. If I am using code on Ticks() with the following means

if (_stoch.PercentD.HasCrossedAbove(_stoch.PercentK, 10))

If will check STO is crossed above or not based on last 10 tick values. is it correct?

Thanks and Regards

R. Vadivelan

PanagiotisCharalampous said:

Hi Vadivelan,

Here it is

            if (_stoch.PercentD.HasCrossedAbove(_stoch.PercentK, 0))
            {
                // Do something
            }

Best Regards,

Panagiotis 

Join us on Telegram

 


PanagiotisCharalampous
02 Jun 2020, 09:12

Hi Vadivelan,

No this will check if the cross has taken place during the last 10 bars.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

velu130486
02 Jun 2020, 09:18

RE:

Hi Panagiotis,

Thanks for your quick reply, Noted your answer.

Thanks and Regards

R. Vadivelan

PanagiotisCharalampous said:

Hi Vadivelan,

No this will check if the cross has taken place during the last 10 bars.

Best Regards,

Panagiotis 

Join us on Telegram