Thank You Anant, but I think I figured it out. Here it is. If anyone can take a look that would be great. Also I did see amny ripshaws with this indicator especially wilh laterally moving markets. That needs to be improved before it can be used effectively.
p1:=13; {13}
p2:=9; {9}
X :=...