You need to use an advise() function within the run() function. For example,
Code:
var Prediction = adviseLong(NEURAL, Objective, Signal_1, Signal_2.....);



Where "Objective" is the target value you are trying to predict (in this case, positive or negative next-bar return designated as +1 and -1 respectively) and "Signal_1, Signal_2, ... etc" are the variables (otherwise known as features, predictors, independent variables etc) that you are using to forecast "Objective".

In terms of the way the script flows, the advise function calls the NEURAL function (the first function in your post). The NEURAL function then calls the R script (the second function in your post).

Does that help?