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 |

Current Bar Range Compared Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
0002ct
Posted : Wednesday, December 6, 2017 12:17:39 PM
Registered User
Joined: 11/19/2015
Posts: 459

Hello.

I was recently helped with a range evaluation question and have a similar evaluation.

How would one count the number of bars back from the current bar, where the count is true if the preceding bar is smaller in range than the most recent bar? That is, count each bar going backward until the count is stopped by a bar larger in range than the current bar. So a count of "5" means that there are 5 bars back that are smaller in range than the current bar, but the 6th is larger.

Is this possible?

Thank you. 

Bruce_L
Posted : Wednesday, December 6, 2017 12:31:59 PM


Worden Trainer

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

The following maxes out at 100 (and will return 100 if it does not find any larger bars).

IIF(H - L < H1 - L1, 0, IIF(H - L < H2 - L2, 1, IIF(H - L < H3 - L3, 2, IIF(H - L < H4 - L4, 3, IIF(H - L < H5 - L5, 4, IIF(H - L < H6 - L6, 5, IIF(H - L < H7 - L7, 6, IIF(H - L < H8 - L8, 7, IIF(H - L < H9 - L9, 8, IIF(H - L < H10 - L10, 9, IIF(H - L < H11 - L11, 10, IIF(H - L < H12 - L12, 11, IIF(H - L < H13 - L13, 12, IIF(H - L < H14 - L14, 13, IIF(H - L < H15 - L15, 14, IIF(H - L < H16 - L16, 15, IIF(H - L < H17 - L17, 16, IIF(H - L < H18 - L18, 17, IIF(H - L < H19 - L19, 18, IIF(H - L < H20 - L20, 19, IIF(H - L < H21 - L21, 20, IIF(H - L < H22 - L22, 21, IIF(H - L < H23 - L23, 22, IIF(H - L < H24 - L24, 23, IIF(H - L < H25 - L25, 24, IIF(H - L < H26 - L26, 25, IIF(H - L < H27 - L27, 26, IIF(H - L < H28 - L28, 27, IIF(H - L < H29 - L29, 28, IIF(H - L < H30 - L30, 29, IIF(H - L < H31 - L31, 30, IIF(H - L < H32 - L32, 31, IIF(H - L < H33 - L33, 32, IIF(H - L < H34 - L34, 33, IIF(H - L < H35 - L35, 34, IIF(H - L < H36 - L36, 35, IIF(H - L < H37 - L37, 36, IIF(H - L < H38 - L38, 37, IIF(H - L < H39 - L39, 38, IIF(H - L < H40 - L40, 39, IIF(H - L < H41 - L41, 40, IIF(H - L < H42 - L42, 41, IIF(H - L < H43 - L43, 42, IIF(H - L < H44 - L44, 43, IIF(H - L < H45 - L45, 44, IIF(H - L < H46 - L46, 45, IIF(H - L < H47 - L47, 46, IIF(H - L < H48 - L48, 47, IIF(H - L < H49 - L49, 48, IIF(H - L < H50 - L50, 49, IIF(H - L < H51 - L51, 50, IIF(H - L < H52 - L52, 51, IIF(H - L < H53 - L53, 52, IIF(H - L < H54 - L54, 53, IIF(H - L < H55 - L55, 54, IIF(H - L < H56 - L56, 55, IIF(H - L < H57 - L57, 56, IIF(H - L < H58 - L58, 57, IIF(H - L < H59 - L59, 58, IIF(H - L < H60 - L60, 59, IIF(H - L < H61 - L61, 60, IIF(H - L < H62 - L62, 61, IIF(H - L < H63 - L63, 62, IIF(H - L < H64 - L64, 63, IIF(H - L < H65 - L65, 64, IIF(H - L < H66 - L66, 65, IIF(H - L < H67 - L67, 66, IIF(H - L < H68 - L68, 67, IIF(H - L < H69 - L69, 68, IIF(H - L < H70 - L70, 69, IIF(H - L < H71 - L71, 70, IIF(H - L < H72 - L72, 71, IIF(H - L < H73 - L73, 72, IIF(H - L < H74 - L74, 73, IIF(H - L < H75 - L75, 74, IIF(H - L < H76 - L76, 75, IIF(H - L < H77 - L77, 76, IIF(H - L < H78 - L78, 77, IIF(H - L < H79 - L79, 78, IIF(H - L < H80 - L80, 79, IIF(H - L < H81 - L81, 80, IIF(H - L < H82 - L82, 81, IIF(H - L < H83 - L83, 82, IIF(H - L < H84 - L84, 83, IIF(H - L < H85 - L85, 84, IIF(H - L < H86 - L86, 85, IIF(H - L < H87 - L87, 86, IIF(H - L < H88 - L88, 87, IIF(H - L < H89 - L89, 88, IIF(H - L < H90 - L90, 89, IIF(H - L < H91 - L91, 90, IIF(H - L < H92 - L92, 91, IIF(H - L < H93 - L93, 92, IIF(H - L < H94 - L94, 93, IIF(H - L < H95 - L95, 94, IIF(H - L < H96 - L96, 95, IIF(H - L < H97 - L97, 96, IIF(H - L < H98 - L98, 97, IIF(H - L < H99 - L99, 98, IIF(H - L < H100 - L100, 99, 100))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Wednesday, December 6, 2017 12:44:59 PM
Registered User
Joined: 11/19/2015
Posts: 459

Thank you very much, Bruce.

Can I write this myself to go further back by following the pattern, or is 100 the max? Purely curious, further days probably not needed as yet.

Thanks again.

Bruce_L
Posted : Wednesday, December 6, 2017 12:48:24 PM


Worden Trainer

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

You can keep following the pattern to increase the number of bars. The 100 bar limit used in the formula was entirely arbitrary.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Wednesday, December 6, 2017 12:54:11 PM
Registered User
Joined: 11/19/2015
Posts: 459

Perfect. Thanks again, Bruce.

Bruce_L
Posted : Wednesday, December 6, 2017 1:08:57 PM


Worden Trainer

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

You're welcome.



-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.