Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Consecutive red or green candles Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
daytradingpwr
Posted : Wednesday, October 28, 2015 10:46:07 AM
Registered User
Joined: 6/15/2015
Posts: 21

Hey Bruce,

I'm looking for 2 scans.

1- detect a minimum of 3 consecutive red candles where the high of the previous red candle doesn't get breached on the way down. Hopefully the scan can also not include stocks that have broken the high of the previous bar. So it could potentially detect patterns where there's 9 candles in a row that don't breach the high of the previous candle.

2 - same scan but for green bars.

 

Thanks much

busterram
Posted : Wednesday, October 28, 2015 11:02:42 AM
Registered User
Joined: 10/9/2011
Posts: 485

3 red bars without high of prev bar breach

c1 <o1 and c2 < o2 and c3 < o3 and h1 < h2 and h2 < h3

3 green bars without low of prev bar breach

c1 > o1 and c2 > o2 and c3 > o3 and l1 > l2 and l2 > l3

Hope this helps

Bruce_L
Posted : Wednesday, October 28, 2015 11:25:55 AM


Worden Trainer

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

The formulas from busterram are probably all you need, but I thought I'd provide some formulas which would give you a count of bars instead of just returning true or false.

The following Indicator Formula returns a count between 3 and 9 for the number of red candles in a row which did not breach the high of the previous candle.

(ABS(C3 >= O3 OR H3 > H4) * 3 + ABS(C3 < O3 AND H3 <= H4) * (ABS(C4 >= O4 OR H4 > H5) * 4 + ABS(C4 < O4 AND H4 <= H5) * (ABS(C5 >= O5 OR H5 > H6) * 5 + ABS(C5 < O5 AND H5 <= H6) * (ABS(C6 >= O6 OR H6 > H7) * 6 + ABS(C6 < O6 AND H6 <= H7) * (ABS(C7 >= O7 OR H7 > H8) * 7 + ABS(C7 < O7 AND H7 <= H8) * (ABS(C8 >= O8 OR H8 > H9) * 8 + ABS(C8 < O8 AND H8 <= H9) * 9)))))) / ABS(C < O AND H <= H1 AND C1 < O1 AND H1 <= H2 AND C2 < O2 AND H2 <= H3))

The following Indicator Formula returns a count between 3 and 9 for the number of red candles in a row which did not breach the high of the previous candle.

(ABS(C3 < O3 OR L3 < L4) * 3 + ABS(C3 >= O3 AND L3 >= L4) * (ABS(C4 < O4 OR L4 < L5) * 4 + ABS(C4 >= O4 AND L4 >= L5) * (ABS(C5 < O5 OR L5 < L6) * 5 + ABS(C5 >= O5 AND L5 >= L6) * (ABS(C6 < O6 OR L6 < L7) * 6 + ABS(C6 >= O6 AND L6 >= L7) * (ABS(C7 < O7 OR L7 < L8) * 7 + ABS(C7 >= O7 AND L7 >= L8) * (ABS(C8 < O8 OR L8 < L9) * 8 + ABS(C8 >= O8 AND L8 >= L9) * 9)))))) / ABS(C >= O AND L >= L1 AND C1 >= O1 AND L1 >= L2 AND C2 >= O2 AND L2 >= L3)

Both busterram's formulas and my formulas assume the Color Based On setting is set to Open vs Close. My formulas assign equality to green while busterram's formulas do not continue counting when the open and close are the same. My formulas should match the colors on the chart for green while busterram's provide better symmetry with the red formulas (I prefer busterram's approach to green but mine is more literal).

The formulas would need to change if you have the Color Based On Setting for price set to Net Change instead of Open vs Close. Note that if you test my formulas and get a division by zero error, this is intentional.

Days Since Last Peak (or other day-counting needs)

Also note that my formulas aren't conditions, they return values. The condition versions of my formulas would just check for at least three bars in a row and would be very similar to what was supplied by busterram. The red Condition Formula would be as follows.

C < O AND H <= H1 AND C1 < O1 AND H1 <= H2 AND C2 < O2 AND H2 <= H3

And the green Condition Formula would be as follows.

C >= O AND L >= L1 AND C1 >= O1 AND L1 >= L2 AND C2 >= O2 AND L2 >= L3



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
daytradingpwr
Posted : Wednesday, October 28, 2015 12:15:46 PM
Registered User
Joined: 6/15/2015
Posts: 21

So if I understand correctly Busterram will only show 3 bars, where are yours can show more than 3?

Bruce_L
Posted : Wednesday, October 28, 2015 12:19:12 PM


Worden Trainer

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

Not quite. The formulas from busterram return true or false and return true if there are three or more bars in a row which qualify. This is also true of the shorter formulas at the end of my post.

The longer formulas at the beginning of my post don't return true or false. You wouldn't want to use them as EasyScan Conditions. Use one of the four short formulas for that.

The long formulas return a count between 3 and 9 based on how many bars in a row the condition was met (it maxes out at 9, but would return 9 for 11 bars in a row).

You would use the long formulas for something like a WatchList Column or in a Custom PCF Indicator with the Plot Style set to Histogram.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
daytradingpwr
Posted : Wednesday, October 28, 2015 3:17:06 PM
Registered User
Joined: 6/15/2015
Posts: 21

ok, got it. They both work really well. Thanks all.

cnixon300
Posted : Friday, July 1, 2016 10:06:45 PM
Registered User
Joined: 8/8/2015
Posts: 1

Busterrams formula worked well for an Easy Scan, I wish to take it one step further to look for 3+ candles in a row followed by a reversal candle of any size but of the opposite color.  Example 3 red followed by green and vise versa.

Bruce_L
Posted : Wednesday, July 6, 2016 9:24:28 AM


Worden Trainer

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

If you extend bustermu's "3 red bars without high of prev bar breach" to add a reversal you would get:

C1 > O1 AND C2 < O2 AND C3 < O3 AND C4 < O4 AND H2 < H3 AND H3 < H4

If you extend bustermu's "3 green bars without low of prev bar breach" to add a reversal you would get:

C1 < O1 AND C2 > O2 AND C3 > O3 AND C4 > O4 AND L2 > L3 AND L3 > L4



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.