how to detect Stoch Cross Over?

 

how to detect Stoch Cross Over?

is this correct?

stochMain = iStochastic(Symbol(),0,stochKperiod,stochDperiod,stochSlowing,stochMethod,0,0,0);
stochSignal=iStochastic(Symbol(),0,stochKperiod,stochDperiod,stochSlowing,stochMethod,0,1,0);

if(stochMain==stochSignal)//stoch cross each other
{
Alert("Stoch Cross over");
}
 
double m = iStochastic(Symbol(),0,stochKperiod,stochDperiod,stochSlowing,stochMethod,0,0,0);
double s=iStochastic(Symbol(),0,stochKperiod,stochDperiod,stochSlowing,stochMethod,0,1,0);

double m1 = iStochastic(Symbol(),0,stochKperiod,stochDperiod,stochSlowing,stochMethod,0,0,1);
double s1=iStochastic(Symbol(),0,stochKperiod,stochDperiod,stochSlowing,stochMethod,0,1,1);


if(m>s&&m1<=s1 || m<s&&m1>=s1)Alert("Stoch Cross over");
 
bool positiveCurr = m > 0,
     positivePrev = m1 > 0,
     crossed = positiveCurr != positivePrev;