Registered User Joined: 1/31/2013 Posts: 8
|
Hi,
I'm trying to write a formula to show the first candle, where close is higher than open, within 5 candles after a new high of the past 250 candles.
So I thought this (but it doesn't work). Can you help, please?
(C1 = MaxC250 AND C > O)
OR
((C2 = MaxC250 AND (C1 > O1 OR C > O))
((C3 = MaxC250) AND (C2 > O2 OR C1 > O1 OR C > O))
((C4 = MaxC250) AND (C3 > O3 OR C2 > O2 OR C1 > O1 OR C > O))
((C5 = MaxC250) AND (C4 > O4 OR C3 > O3 OR C2 > O2 OR C1 > O1 OR C > O))
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There isn't anything wrong with your formula if you are comparing the five previous closes to the current most recent 250 closes to define your new high and want any bar after that new high having a close above the open qualify condition formula to return true now. These would be perfectly valid choices, but if the formula doesn't match your expectations, then these choices probably actually aren't what you want.
But the formula would depend on both the definition of a new high and if you want the current bar to be the first bar where the close is higher than the open the new high or not. For example, the following defines a new high as the high of the bar being higher than any of the previous 249 highs and only returns true when the current bar is the first bar after the new high with a close above the open.
C > O AND (H1 > MAXH249.2 OR (C1 <= O1 AND H2 > MAXH249.3) OR (C1 <= O1 AND C2 <= O2 AND H3 > MAXH249.4) OR (C1 <= O1 AND C2 <= O2 AND C3 <= O3 AND H4 > MAXH249.5) OR (C1 <= O1 AND C2 <= O2 AND C3 <= O3 AND C4 <= O4 AND H5 > MAXH249.6))
But this may or may not be what you want either. If it isn't what you want, we would need further clarification from you as to your particular definitions or intent for the formula.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|