This setup ensures that Buy labels are only shown when the price is above the EMA and the MACD is positive. Similarly, Sell labels are only shown when the price is below the EMA and the MACD is negative. You can now change the EMA period to any value you want via the user input.