Alerts script that has triggers on multiple moving average crossovers so that profit is maximised, it also has an optional control moving average, enabled by default, that when active will stop trading when the price (first ma) is below the control moving average.
Source code is open so that others can use and modify Click Below for Alerts Study version:
Disclaimers, not an expert, not intended to be financial advise.