Hi everyone, I'm new to this forum and the pine language. I started designing my first key level based indicator. I simply created horizontal lines on some price levels using the "hline" function. Now I would like my script to detect when the price hits one of the levels and moves away by a specific number of pips. I would also like to add an alert about this feature. Can anyone give me some advice?
I would suggest using an input to set the number of pips away from the price that you are looking for. That way you won't have to change your code if you decide to use a different number. You can just change this in the settings.
numberOfPipsAway = input.int(14)
Then you could pass this variable as part of the conditions for an if statement.