How would I go about creating an alert (pop up and sound) if say slow stochastic's is below 20? Would I have to rewrite the whole stochastic's indicator in a script? Rewrite the indicator as a class object? Could I simply add it to the stochastic's indicators' script? Or simply reference it from a new script?
Adding it to the indicator does break anything. You broke it.
Either after the main loop, or in a new indicator, on a new bar, get the stochastic values for bar 2/1 and test for an alert.
Scripts are for one time execution.