Registered User Joined: 11/21/2016 Posts: 16
|
Bruce,
I have been struggling to create an Easyscan to find stocks with the most number of green days in a row where each close is higher than the previous high. I think that either CountTrue or TrueInRow needs to be used. For me, a green day is the Close of that day is higher than the Open of that day (I have Color Based on "Open vs Close").
In a class I attended, they said something like CountTrue(C>C1,3) finds stocks up 3 days in a row (but what about more than that?) and TrueInRow(C>C1,50) counts how many days in a row a stock was up, returns a value like 5 or 9. But it was just a blur and my notes are not good.
In my results window, I would like a column to sort on the number of green days in a row. You may have guessed, I am trying to find parabolic short setups.
A typical example I want to find is like HTZ, it's up 6 green days in a row. Each close is higher than the previous high.
Then lastly, can I create a column that calculates the percent total change ((L of oldest day) - (H of today))/(Low of Oldest day) over those green days, so I can sort to find the biggest % mover, regardless of how many days it was. A 3 day runner could be up way more than a snoozer that's up 6 days. In the case of HTZ below, it's about 41% change from the low of $10.85 to high of $15.34 over 6 green days.
Thanks, Derek
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The actual count of the number of green bars in a row where the close is higher than the previous high is fairly straightforward (and quite similar to what you derived from your notes). This will max out at 10 bars.
TrueInRow(C > O AND C > H1, 10)
Calculating the percent change from the low of the oldest day to current high is a bit more complicated (also out to 10 bars).
100 * (H / IIF(C <= O OR C <= H1, H, IIF(C1 <= O1 OR C1 <= H2, L, IIF(C2 <= O2 OR C2 <= H3, L1, IIF(C3 <= O3 OR C3 <= H4, L2, IIF(C4 <= O4 OR C4 <= H5, L3, IIF(C5 <= O5 OR C5 <= H6, L4, IIF(C6 <= O6 OR C6 <= H7, L5, IIF(C7 <= O7 OR C7 <= H8, L6, IIF(C8 <= O8 OR C8 <= H9, L7, IIF(C9 <= O9 OR C9 <= H10, L8, L9)))))))))) - 1)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 11/21/2016 Posts: 16
|
Bruce,
Thanks! I am so glad you are so good with this. There's no way I could have figured out the percent change formula.
Can you explain what TrueInRow and CountTrue is doing internally. Here are the only descriptions I am aware of http://forums.worden.com/default.aspx?g=posts&t=66280
TrueInRow(b, x) -> Will return a value between 0 and period that is how many times the Boolean formula was true in a row
CountTrue(b, x) -> Will return the number of times Boolean formula was true in the period
For TrueInRow(C > O AND C > H1, 10), does it take the given boolean formula (expanded to show the "assumed" zero's) (C0>O0 AND C0>H1) then increment the period by one (C1>O1 AND C1>H2), and so forth for x periods, so essentially it generates 10 boolean formulas, which are either True or False. Then it counts backwards in time, from the first period, how many True's are in a row.
For example (newest time on the left, ie, the current bar 0):
(True, True, False, True, True, True, True, False, False, True), count from the left, answer = 2 True's in a row (not 4).
If the first value is False, the answer is 0 (zero).
Whereas, the same boolean and period used in CountTrue, with the same True/False results, would return 7 (7 True values).
Michael said there would be a full PDF document at some point for the formulas, in particular the new ones in V17.
Thanks, Derek
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, the TrueInRow() function would return 2 and the CountTrue() function would return 7 for the reasons you state.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|