Need code for below signals

Buy signal

1.20 min EMA is sloping upwards.
2.MACD gives a bullish cross over.
3.5 EMA should be above 20 EMA line.
4.5 min candle should close above the 20 EMA line.
5.Stochastics should not be in overbought condition.
6.If Stochastics is in buy mode already, enter the trade.
7.If Stochastics is not in buy mode, wait for the stochastics to give a buy signal and enter the trade.
8.If Stochastics is overbought, a fresh buy signal can be used to enter if the MACD is still positive.

Sell Signal

1.20 min EMA is sloping downwards.
2.MACD gives a bearish cross over.
3.5 EMA should be below 20 EMA line.
4.5 min candle should close below the 20 EMA line.
5.Stochastics should not be in oversold condition.
6.If Stochastics is in sell mode already,  enter the trade.
7.If Stochastics is not in sell mode,  wait for the stochastics to give a sell signal and enter the trade.
8.If Stochastics is oversold, a fresh sell signal can be used to enter if the MACD is still positive.

In the above buy and sell condition contains with different time frames of candles as it can not be coded with tradescript.