Sub-Window TrendLine Email Alerts.mq4

I Need Help Programming the attached indicator so that it will close open trades to which its attached to based on a break of the RSI Trend Line. It Does have the capability to do Stochastic trend line break as well.

I Managed to do a hack job adding an email Alert to it already.

Thank You in advance