Registered User Joined: 10/7/2004 Posts: 1,178

Below is the formula you provided me today:
CountTrue(O + H + L + C = O1 + H1 + L1 + C1, 390)  CountTrue(V1 = 0, 390)
I would like to change it to 1Ago (keeping it as 390 minutes). Is this correct?
CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 390)  CountTrue(V2 = 0, 390)
Also 2Ago?
CountTrue(O2 + H2 + L2 + C2 = O3 + H3 + L3 + C3, 390)  CountTrue(V23= 0, 390)
And finally is the below correct?
CountTrue(O + H + L + C = O1 + H1 + L1 + C1, 390)  CountTrue(V1 = 0, 390)>CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 390)  CountTrue(V2 = 0, 390)
Thanks, Bruce. What would I and we do without you?

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

Your first conversion looks correct. Your second conversion has V23 where it should have V3.
Your last formula looks correct, but you should be able to make it a lot more efficient by counting a single bar on each side of the inequality instead of 390 bars on each side of the inequality (because all of the other bars being counted should be the same on both sides).
CountTrue(O + H + L + C = O1 + H1 + L1 + C1, 1)  CountTrue(V1 = 0, 1) > CountTrue(O390 + H390 + L390 + C390 = O391 + H391 + L391 + C391, 1)  CountTrue(V391 = 0, 1)
Bruce Personal Criteria Formulas TC2000 Support Articles

Registered User Joined: 10/7/2004 Posts: 1,178

Thanks for noticing my typoand for suggesting an improvement in efficiency in the longer final formula. I wish I understood the math, but with your help I am learning gradually!

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

In this case the math behind the simplification is a lot simpler than it might seem on the surface.
The part before the > sign in your version looks at the most recent 390 bars and counts how many times the formula is true.
CountTrue(O + H + L + C = O1 + H1 + L1 + C1, 390)  CountTrue(V1 = 0, 390)
And the part after the > sign does the same but for the 390 bars ending 1bar ago.
CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 390)  CountTrue(V2 = 0, 390)
So 389 of the bars are being counted in both formulas. Those 389 bars will come up with the same result in both formulas. You could break down the first formula into the following.
CountTrue(O + H + L + C = O1 + H1 + L1 + C1, 1)  CountTrue(V1 = 0, 1) + CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 389)  CountTrue(V2 = 0, 389)
And the second part into the following.
CountTrue(O390 + H390 + L390 + C390 = O391 + H391 + L391 + C391, 1)  CountTrue(V391 = 0, 1) + CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 389)  CountTrue(V2 = 0, 389)
Note that this section is the same in both.
CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 389)  CountTrue(V2 = 0, 389)
So we can eliminate it from both sides of the inequality to get the more efficient version.
CountTrue(O + H + L + C = O1 + H1 + L1 + C1, 1)  CountTrue(V1 = 0, 1) > CountTrue(O390 + H390 + L390 + C390 = O391 + H391 + L391 + C391, 1)  CountTrue(V391 = 0, 1)
Bruce Personal Criteria Formulas TC2000 Support Articles

Registered User Joined: 10/7/2004 Posts: 1,178

Thanks for the explanation. I need some time to study and absorb this.
In the meantime, please convert the below to your more efficient formula:
CountTrue(O2 + H2 + L2 + C2 = O3 + H3 + L3 + C3, 390)  CountTrue(V2= 0, 390)<CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 390)  CountTrue(V1=0, 390)

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

Please try the following:
CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 1)  CountTrue(V1 = 0, 1) > CountTrue(O391 + H391 + L391 + C391 = O392 + H392 + L392 + C392, 1)  CountTrue(V391 = 0, 1)
Bruce Personal Criteria Formulas TC2000 Support Articles

Registered User Joined: 10/7/2004 Posts: 1,178

I am testing the efficient PCF from yesterday representing the # Anchors 2Ago < # Anchors 1Ago. See it below:
CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 1)  CountTrue(V1 = 0, 1) > CountTrue(O391 + H391 + L391 + C391 = O392 + H392 + L392 + C392, 1)  CountTrue(V391 = 0, 1)
Now, please change this PCF to represent # Anchors 2Ago > # Anchors 1Ago.

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

If I am understanding correctly, you should be able to just change the > sign in the middle to a < sign instead.
CountTrue(O1 + H1 + L1 + C1 = O2 + H2 + L2 + C2, 1)  CountTrue(V1 = 0, 1) < CountTrue(O391 + H391 + L391 + C391 = O392 + H392 + L392 + C392, 1)  CountTrue(V391 = 0, 1)
Bruce Personal Criteria Formulas TC2000 Support Articles
