No filter is used for only long or only short positions, but you can select buy only or sell only based on other indicators or whatever you feel is the direction of trading.
NOTE: you can add this strategy to your chart but you should modify the backtest day otherwise you will get an error due to calculation limits of pine script. For example, on one minute chart, you should set the backtest day from today only. For past days, set both start day and and day.
I have also a study with alarms.
Please use comment section for any feedback.