StepMA_Stoch crossover

 
Hi all,

I am trying to develop an EA that is supposed to open trades when the 2 lines of StepMA Stoch indicator are crossovering each other. More particularly,

I am setting:
double diCustom0=iCustom(NULL, 0, "StepMA_Stoch_NK", 10, 1, 0, 0, 0);
double diCustom1=iCustom(NULL, 0, "StepMA_Stoch_NK", 10, 1, 0, 1, 0);
double diCustom2=iCustom(NULL, 0, "StepMA_Stoch_NK", 10, 1, 0, 0, 1);
double diCustom3=iCustom(NULL, 0, "StepMA_Stoch_NK", 10, 1, 0, 1, 1);

if (diCustom3 > diCustom2 && diCustom0 > diCustom1)
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0, NULL, Magic, 0, clr);
if (diCustom2 > diCustom3 && diCustom1 > diCustom0)
OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, NULL, Magic, 0, clr);

However, in many cases the opening time of new trades does not occur when there is a crossover.

Do I try to find the crossovers with a wrong method (shift = 0, shift = 1)? Is there any well-known issue with this tactic?

Thanks in advance for your help!
 

try to put some Print() or Alert() to find out the value if it's the same that on your mind

Reason: