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.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.