@Zachc Thanks. My opinion is you are working hard on a study you will have a very hard time making it what you desire. The problem is the ADX. I have done a quick chart to give you ideas that may be easier to work into your strategy. That ADX oscillator is in ToS somewhere. Sorry I forgot the name. So take a look and see if it can improve your approach to this strategy.
The White line on top indicator matches the red/green line of the lower. On the upper the cross of 2 and -2 would be the signals and the parts inbetween can be ignored. The white line of the lower should signal the points or reversal of price when it crosses zero. Some way to avoid excess signals in chop may be needed. Ooops may have missed marking a few places but you get the idea. Good coding to you.