Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

PCF to find the number of bars (days) since the last high Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
cbynum
Posted : Friday, March 20, 2015 4:43:18 PM
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.

 

Bruce_L
Posted : Monday, March 23, 2015 12:05:38 PM


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
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.