Trading script required for below condition

I want trading script for this condition.

whenever MACD signal line and MACD converges (before cross over) and the gap is minimum, I want to initiate the trade. i.e I don’t want to wait till cross over happens.
Secondly I want RSI to be above 30

Thirdly (optional), Bollinger Band slope should change from vertical to horizontal, i.e difference between previous, next previous should be minimal

Kindly provide me the trade script for this condition