Registered User Joined: 12/7/2012 Posts: 5
|
So for a 10 day high, I want 0 if the high today is the highest high for the last 10 days and 10 if the highest high was 10 days ago.
Any help would be appreciated.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A 10 day high would actually return numbers from 0 through 9.
ABS(H < MAXH10) * (ABS(H1 = MAXH10) + ABS(H1 < MAXH10) * (ABS(H2 = MAXH10) * 2 + ABS(H2 < MAXH10) * (ABS(H3 = MAXH10) * 3 + ABS(H3 < MAXH10) * (ABS(H4 = MAXH10) * 4 + ABS(H4 < MAXH10) * (ABS(H5 = MAXH10) * 5 + ABS(H5 < MAXH10) * (ABS(H6 = MAXH10) * 6 + ABS(H6 < MAXH10) * (ABS(H7 = MAXH10) * 7 + ABS(H7 < MAXH10) * (ABS(H8 = MAXH10) * 8 + ABS(H8 < MAXH10) * (ABS(H9 = MAXH10) * 9)))))))))
You would need to use an 11 bar high to return numbers from 0 through 10.
ABS(H < MAXH11) * (ABS(H1 = MAXH11) + ABS(H1 < MAXH11) * (ABS(H2 = MAXH11) * 2 + ABS(H2 < MAXH11) * (ABS(H3 = MAXH11) * 3 + ABS(H3 < MAXH11) * (ABS(H4 = MAXH11) * 4 + ABS(H4 < MAXH11) * (ABS(H5 = MAXH11) * 5 + ABS(H5 < MAXH11) * (ABS(H6 = MAXH11) * 6 + ABS(H6 < MAXH11) * (ABS(H7 = MAXH11) * 7 + ABS(H7 < MAXH11) * (ABS(H8 = MAXH11) * 8 + ABS(H8 < MAXH11) * (ABS(H9 = MAXH11) * 9 + ABS(H9 < MAXH11) * (ABS(H10 = MAXH11) * 10))))))))))
Days Since Last Peak (or other day-counting needs)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|