Subscription & data-feed pricing Class schedule

Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.

 Consecutive up/down days Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
neilkhess
 Posted : Tuesday, March 26, 2019 4:52:43 PM
Registered User
Joined: 8/2/2014
Posts: 12

Is there a formula that would show the greatest number of consecutive up or down days for an instrument in the last 252 days?

neilkhess
 Posted : Tuesday, March 26, 2019 5:04:15 PM
Registered User
Joined: 8/2/2014
Posts: 12

And to folow up, would there be a way to scan for instruments whose current "Streak" matches or is -1 from the 252 day streak-high?

Bruce_L
 Posted : Wednesday, March 27, 2019 9:42:01 AM

Worden Trainer

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

The answer to the first queqstion really depends on if you want to check for a streak ending within those 252 trading days. This maxes out at 50 bars in a row, You can change this if you want, but it seems to be large enough to work for most things besides symbols like the FX symbols which always go up.

`MAX(TrueInRow(C <> C1 AND SGN(C - C1) = SGN(C - C2), 50), 252)`

Or if you want the streak to be entirely containing within the 252 trading day span. I can't think of a method which is short and fast enough to be practical for this second interpretation.

Assuming the first interpretation works, a formula for the second question could be written as follows.

`TrueInRow(C <> C1 AND SGN(C - C1) = SGN(C - C2), 50) >= MAX(TrueInRow(C <> C1 AND SGN(C - C1) = SGN(C - C2), 50), 252) - 1`

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos 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.