Do what swingtraderkk says.
The Stoch function seems to have no return value hence your code should not work anyway.
rSlowK and rSlowD are global variables which are manipulated by the Stoch function.