Assuming I can get the SMA redrawn on each bar, I'll then need to figure out a way to keep track of the number of intersections so the user an tell it how many (s)he wants.
My *thought* is that one could tell it to find 2 intersections and it might dynamically show the SMA to which pullbacks are reverting without the user having to decide what period is currently viable.
And, for anyone reading, it's not because I can't figure it out on the fly. It's so I can tell a computer what to do in an automated strategy. To me, that's the main strength of indicators. They lag price and a human can usually eyeball what they're telling us better than the computer can, BUT, we can't code a strategy using spoken English. (Or, *I* can't.) Indicators can provide a language a computer can understand. Ultimately, that's why I'm chasing this particular rabbit down this particular hole.