I am writing an indicator which gives an alert when there appears some certain candle pattern near an S/R level. It needs to recognize the swing direction in which it approaches the S/R level. Recognizing the swing direction in the indicator is a bit difficult for me. Would you give me some advice on it? Thanks in advance.