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

Second condition within 30 bars of first condition being met Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
ADX trader
Posted : Monday, September 18, 2017 3:21:42 PM
Registered User
Joined: 9/10/2009
Posts: 11

If a first condition is met then I am looking for the second condition to occur within 30 bars.

First condition:

CountTrue(c<c4,9)=9 

Second condition:  

CountTrue(c<l2,x)=13, where x only looks back to when the original condition was met (+4).

I am assuming that I need a counter.

 

 

Bruce_L
Posted : Monday, September 18, 2017 3:46:36 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

This may or may not be what you want, but I will need significant additional clarification from you as to the actual intent of the question if it is not correct.

(CountTrue(C < C4, 9) = 9 AND CountTrue(C < L2, 13) = 13) OR (CountTrue(C1 < C5, 9) = 9 AND CountTrue(C1 < L3, 14) = 13) OR (CountTrue(C2 < C6, 9) = 9 AND CountTrue(C2 < L4, 15) = 13) OR (CountTrue(C3 < C7, 9) = 9 AND CountTrue(C3 < L5, 16) = 13) OR (CountTrue(C4 < C8, 9) = 9 AND CountTrue(C4 < L6, 17) = 13) OR (CountTrue(C5 < C9, 9) = 9 AND CountTrue(C5 < L7, 18) = 13) OR (CountTrue(C6 < C10, 9) = 9 AND CountTrue(C6 < L8, 19) = 13) OR (CountTrue(C7 < C11, 9) = 9 AND CountTrue(C7 < L9, 20) = 13) OR (CountTrue(C8 < C12, 9) = 9 AND CountTrue(C8 < L10, 21) = 13) OR (CountTrue(C9 < C13, 9) = 9 AND CountTrue(C9 < L11, 22) = 13) OR (CountTrue(C10 < C14, 9) = 9 AND CountTrue(C10 < L12, 23) = 13) OR (CountTrue(C11 < C15, 9) = 9 AND CountTrue(C11 < L13, 24) = 13) OR (CountTrue(C12 < C16, 9) = 9 AND CountTrue(C12 < L14, 25) = 13) OR (CountTrue(C13 < C17, 9) = 9 AND CountTrue(C13 < L15, 26) = 13) OR (CountTrue(C14 < C18, 9) = 9 AND CountTrue(C14 < L16, 27) = 13) OR (CountTrue(C15 < C19, 9) = 9 AND CountTrue(C15 < L17, 28) = 13) OR (CountTrue(C16 < C20, 9) = 9 AND CountTrue(C16 < L18, 29) = 13) OR (CountTrue(C17 < C21, 9) = 9 AND CountTrue(C17 < L19, 30) = 13) OR (CountTrue(C18 < C22, 9) = 9 AND CountTrue(C18 < L20, 31) = 13) OR (CountTrue(C19 < C23, 9) = 9 AND CountTrue(C19 < L21, 32) = 13) OR (CountTrue(C20 < C24, 9) = 9 AND CountTrue(C20 < L22, 33) = 13) OR (CountTrue(C21 < C25, 9) = 9 AND CountTrue(C21 < L23, 34) = 13) OR (CountTrue(C22 < C26, 9) = 9 AND CountTrue(C22 < L24, 35) = 13) OR (CountTrue(C23 < C27, 9) = 9 AND CountTrue(C23 < L25, 36) = 13) OR (CountTrue(C24 < C28, 9) = 9 AND CountTrue(C24 < L26, 37) = 13) OR (CountTrue(C25 < C29, 9) = 9 AND CountTrue(C25 < L27, 38) = 13) OR (CountTrue(C26 < C30, 9) = 9 AND CountTrue(C26 < L28, 39) = 13) OR (CountTrue(C27 < C31, 9) = 9 AND CountTrue(C27 < L29, 40) = 13) OR (CountTrue(C28 < C32, 9) = 9 AND CountTrue(C28 < L30, 41) = 13) OR (CountTrue(C29 < C33, 9) = 9 AND CountTrue(C29 < L31, 42) = 13) OR (CountTrue(C30 < C34, 9) = 9 AND CountTrue(C30 < L32, 43) = 13)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ADX trader
Posted : Monday, September 18, 2017 4:23:05 PM
Registered User
Joined: 9/10/2009
Posts: 11

Thanks.  It appears to be more of a sludge hammer approach than I anticipated, but it works.

Bruce_L
Posted : Monday, September 18, 2017 4:41:39 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

It uses "brute force" and checks every possible combination individually because x needs to change in the second condition for each of the 31 possible places where the first condition could be true.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Al_Gorithm
Posted : Monday, September 18, 2017 5:07:07 PM

Registered User
Joined: 6/30/2017
Posts: 1,227

I prefer "sludge hammer" to "brute force" but that's just me. LOL. 

PCFs ain't always pretty, but in Bruce's hands they become an art form. :)

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.