I am evaluating a bunch of functions for enter signal. One of the function is the ADX. What I want to be able to do is evaluate the ADX on a certain period and check the value of X number of bars back to see if a certain value was met. Is some case I want to look back 3 bars in others 13 bars. So I created variables for ADX Period and the # of bars back a wanted to evaluate. The place I am getting stuck is how to write the formula. The ghetto side of me wants to do a bunch of if / else if statements but that requires me to change the code each time to account for the # of bar look backs rather than just change the variable in the strategy.
Is there any help out there for me?
Comment