CROSS function not functining as desired

I have just join this forum and a novice in this field and need help to utilise the software i have purchased.

I have written the following scan code to find out all those stock where %K value has crossed %D value

Buy = Cross(StochK(14,3),StochD(14,3,3));
Sell = Cross(StochD(14,3,3),StochK(14,3));
SetTradeDelays( 1, 1, 1, 1 );
BuyPrice = SellPrice = Open;
// trade size: 25% of current portfolio equity
SetPositionSize( 25, spsPercentOfEquity );

When I scan the system to identify all those shock where StockK has crossed StochD for example I run it for 29 june 2017 it does not identify SINTEX whereas when I run it for the period 20 june 2017 to 29 June 2017 then it does identify the stock with BUY on 20 June 2017 whereas the graph mark it on 29 june 2017 ( graph marking is correct as %K cross %D between 28th and 29th June 2017

Please help

Regards
Sanjib Biswas

The only non-functioning as desired part is you - the user.
Cross works as documented http://www.amibroker.com/f?cross
Debugging your own formulas is your own task
http://www.amibroker.com/kb/2014/09/29/debugging-techniques-part-1-exploration/

Thank you, got your point