This script will enter a long position when the short-term moving average (9 periods) crosses above the long-term moving average (21 periods), and it will close the position when the short-term moving average crosses below the long-term moving average.
Remember to adjust the periods of the moving averages and other parameters according to your specific trading style and risk tolerance.