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 |

PCF for Swing Point Highs and Lows Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Gone South
Posted : Wednesday, November 14, 2012 5:34:44 AM
Registered User
Joined: 1/28/2012
Posts: 62

Hello,

Following the technique of L.A. Little, I'm trying to identify Swing Point Highs (SPHs) and Swing Point Lows (SPLs) on a daily chart.

The status of a bar as a SPH or SPL is boolean, so I don't know if it's possible to identify them on a chart.

I'm having difficulty writing the condition, too. An SPH is a bar whose High is higher than the High of at least the 6 bars that follow it although there's no limit on how many consecutive bars could have lower Highs.

Is it possible to write such a condition in TC2000? If the condition can be written, is there some way to identify the SPHs and (with a converse PCF) the SPLs on a chart, perhaps by rendering the condition as an Indicator yielding a 1 or 0 result?

Thanks very much.

 

Bruce_L
Posted : Wednesday, November 14, 2012 8:42:48 AM


Worden Trainer

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

Start by creating the following Custom PCF Indicator for the Swing Point High where it is first detected:

- Plot Style: Doesn't matter (because of the Plot Opacity setting below).
- Plot Color: Doesn't matter (because of the Plot Opacity setting below).
- Period: 1
- Average Type: Doesn't matter (becasue the Period is set to 1).
- Formula: H6 * ABS(H6 > MAXH6.7 AND H6 > MAXH6)
- Line Style: Doesn't matter (because of the Plot Opacity setting below).
- Line Width: Doesn't matter (because of the Plot Opacity setting below).
- Plot Opacity: All the way to the left.

Then create a Custom PCF Indicator for the Swing Point Low where it is first detected using the same settings as above with the exception of changing the Formula to:

L6 * ABS(L6 < MINL6.7 AND L6 < MINL6)

Now add 1-Period Simple Moving Averages to both Custom PCF Indicators and set the Offset to -6 (the negative is important). I would probably set the Plot Style of these Moving Average indicators to Dots.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Wednesday, November 14, 2012 9:44:19 AM
Registered User
Joined: 1/28/2012
Posts: 62

Wow! This is brilliant. And quick, too... just 3 hours. I'm going to stop even trying. Thanks, Bruce.

Bruce_L
Posted : Wednesday, November 14, 2012 9:49:29 AM


Worden Trainer

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

Please don't stop trying. My purpose isn't to create indicators. That is just a side effect. My hope is that the indicators and formulas I create serve as examples to help others learn new techniques for using our products.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Wednesday, November 14, 2012 10:04:40 AM
Registered User
Joined: 1/28/2012
Posts: 62

Bruce... don't worry. I got middling competent at programming indicators in my previous stock analysis software and want to get better at PCFs, too. I'm certainly not averse to copying from the work of others or giving it a go myself, although some of them, like the Historical Volatility (50 days), look pretty intimidating. Thanks, again.

Gone South
Posted : Monday, December 10, 2012 11:55:37 AM
Registered User
Joined: 1/28/2012
Posts: 62

Hello, Bruce

I've been using the formula above, along with the -6 offset to display the swing points. However, I've discovered an anomaly I don't understand.

I can't seem to paste the screen shots I took, but there are some bars that clearly meet the criteria for a swing point that are NOT identified as such.

They're very obvious and in the middle of the chart, so it's a mystery. Wish I could sent a screen shot to show the problem.

Thanks.

Eric

 

Bruce_L
Posted : Monday, December 10, 2012 11:59:12 AM


Worden Trainer

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

Some example symbols and dates would probably be enough to try and troubleshoot the issue. The best topic of which I'm aware on how to post images in the forums is Inserting A Chart into A Worden post.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Monday, December 10, 2012 12:53:53 PM
Registered User
Joined: 1/28/2012
Posts: 62

Hi Bruce,

Those instructions don't work for us Mac users... no URL reference to paste in.

Here are two examples of the problem:

1) Symbol: MG340 (Morningstar's Food & Beverage Industry)

If we look at the weekly chart, there are swing point highs at April 27 and July 6. There is also a swing point low at June 8. These are fine. However, on July 27 there is another swing point low &mdash; there's no lower low after that at all. But is not marked as a swing point low.

MG340 on the monthly chart shows at least 2 swing point lows since April 2009 that are not marked: May 2010 and October 2011.

2) Symbol: MG310 (Morningstar Consumer Durables Industry)

On the Daily chart, there are 4 swing point highs and 3 swing point lows since Sept. 10 this year. However, on Nov. 20, we have a wide-range bar with a swing point high. It is ALSO a swing point low, as there is no lower low since. It is not marked as such.

I'm baffled.

Thanks for the help.

Regards,

Eric

 

Bruce_L
Posted : Monday, December 10, 2012 1:21:04 PM


Worden Trainer

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

The week of July 27th doesn't qualify for MG340 because the week of June 16th has a lower low.

November 20th doesn't qualify for MG310 because November 14th and November 15th both have lower lows.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Monday, December 10, 2012 11:54:33 PM
Registered User
Joined: 1/28/2012
Posts: 62

Hi Bruce,

Thanks for that. I was not considering the prior 5 bars, just the subsequent 5 (including the swing point bar, that totals 6 both ways). That count is critical: L.A. Little fixed on 6 as optimum. I hope he's right!

The way he 'qualifies' a trend from the swing points is by volume: if the new SPH has greater volume than the prior SPH, then it's a 'confirmed' trend. If volume is lower, it's a 'suspect' trend.

To ease that qualification, I've overlayed your swing point indicators (one for SPH and one for SPL) on the volume bars, showing them as low-opacity histograms in grey and white. It's still a lot of visual inspection, estimating the height of the volume histogram, running the mouse over them where they're too close to call.

Is it possible to create a condition to divide the swing points, based on volume comparison? For example, if the volume of the new SPH is higher than the volume of the previous SPH, then the condition is true. If this was possible, then I could have four different colored dot markers on the chart: confirmed SPH, suspect SPH, confirmed SPL and suspect SPL.

Since 'confirmed' trends have higher probabilities for a successful trade, 4 types of swing point on the chart would speed visual inspection by an order of magnitude.

Programming it, I'm not familiar with how to create the volume comparison. 

As always, I appreciate your help.

- Eric

Bruce_L
Posted : Tuesday, December 11, 2012 7:50:27 AM


Worden Trainer

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

It is theoretically possible to do so using the techniques given in the Days Since Last Peak (or other day-counting needs) topic, but the formulas end up being too long and slow to be practical or post in the forums if we look back more than a few bars prior to the most recent swing high or swing low to detect the previous swing high or swing low.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Tuesday, December 11, 2012 9:28:07 AM
Registered User
Joined: 1/28/2012
Posts: 62

Too true.

The maximum number of bars in any of my charts in any time frame is 60, but I've seen long bull runs where there could be 50+ bars between a pair of swing point highs.

Thanks for the help.

 

Gone South
Posted : Saturday, January 12, 2013 1:58:01 PM
Registered User
Joined: 1/28/2012
Posts: 62

Hi Bruce,

I've been using your swing point formula to display Swing Point Highs (SPHs) and Swing Point Lows (SPLs). It works very well and displays beautifully as dots on the charts. 

Reviewing the strategy, I note that the swing point close on a new SPH is supposed to exceed the close on the prior SPH.

No problem, I thought... I'll just piggy-pack on the SPH formula:

IF (H6 * ABS(H6 > MAX6.7 AND H6 > MAXH6)) THEN C

Using the moving average plotting trick you taught, I thought the original formula and moving average trick would identify the bar, but the new dot would appear on the closing value. Well, um, it didn't work. The correct bar was marked, again at the high.

Thanks for the help.

 

diceman
Posted : Saturday, January 12, 2013 2:20:59 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

Change H6 * ABS to C6 * ABS

 

 

 

 

 

 

Thanks

Gone South
Posted : Saturday, January 12, 2013 10:06:03 PM
Registered User
Joined: 1/28/2012
Posts: 62

Thanks, Diceman. That works. Didn't know you'd become a vigilante tech for Worden!

Gone South
Posted : Wednesday, January 16, 2013 1:02:06 PM
Registered User
Joined: 1/28/2012
Posts: 62

Hello Bruce,

Delving with more care into Little's technique, I find that his 6 day count includes the current day. No problem adjusting your formula for that. 

 

L5 * ABS(L5 < MINL5.6 AND L5 < MINL5)

But I also find that he does NOT take into account days prior to a Swing Point High or Low, when determining the Swing Point. For example, one of the prior 5 days to a Swing Point Low could have a lower Low. All Little cares about is that the Swing Point Low is lower than the following 5 days.

I've messed around with your formula, but I'm too dense to get it right. Your help is appreciated. Thanks.

Bruce_L
Posted : Wednesday, January 16, 2013 1:07:21 PM


Worden Trainer

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

The L5 < MINL5.6 portion of the formula is what checks for the days prior to the swing point low. We can eliminate that and get:

L5 * ABS(L5 < MINL5)

I am not familiar with Litte's work. Most people defining swing point highs and swing point lows have requirements both before and after the swing point high or low.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Wednesday, January 16, 2013 2:16:55 PM
Registered User
Joined: 1/28/2012
Posts: 62

Hi Bruce,

There is a requirement before the swing point. 

I actually did have your formula figured out. The thing I couldn't get was that the 5 bars prior to the Swing Point Low can have lower Lows, but they must themselves be excluded as swing points. The Swing Point Low is the bar that is followed by 5 bars with higher lows. The 6th bar after could be yet another swing point with a higher low than the 5 bars that precede it, as long as it has a lower low than the 5 bars after it.

Using your first formula from when we started this thread probably nets 99% of the swing points. Yet, in Little's 2011 book, Trend Qualification and Trading, there are scattered examples of the phenomenon where the swing point complies with this spec, yet doesn't look like an clear "V" pattern because of those prior bars. 

Thanks again!

Gone South
Posted : Thursday, January 17, 2013 8:48:57 AM
Registered User
Joined: 1/28/2012
Posts: 62

Hi Bruce,

I've been trying to solve this thing overnight.

Definition of L5 as a Swing Point Low (SPL) is clear: L5 * ABS(L5 < MINL5). What happens before it is giving me trouble as there are two situations to cover.

If L11 is not an SPL, then L6 through L10 are eligible to be SPLs, although, if one of them were, then L5 would not be.

If L11 is an SPL, then L6 through L10 are NOT eligible to be SPLs, even if every one of them had a lower Low than L5.

I've been testing SPH formulas on the daily chart of DBC, where last Oct. 19 should be a Swing Point High, even though Oct. 11 and Oct. 17 have higher Highs. Those two bars are rendered ineligible due to their being within 5 bars of the SPH on Oct. 11.

Thanks again.

Bruce_L
Posted : Thursday, January 17, 2013 1:14:12 PM


Worden Trainer

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

I find an article written by Little and I'm starting to see why others have requsted lower highs both before and after the swing point low. The version both you and Little describe would seem to allow a swing point high in the midst of sustained downtrend simply by having that swing point high be above the previous bar even if it is below all of the other prior bars.

Little does seem to require a potential swing point high to be above both the previous potential swing point high and the previous bar. This means at the very least that we should modify our swing point high formula to:

H5 * ABS(H6 < H5 AND H5 > MAXH5)

And our swing point low formula to:

L5 * ABS(L6 > L5 AND L5 < MINL5)

Having an actual swing point high 5-bars or less prior to the new swing point high is impossible because the new swing point high would cause the prior potential swing point high to not become an actual swing point high.

If there was an actual swing point high 6-bars prior to the new swing point high, then the new swing point high formula would seem to be the only requirement because none of the potential swing point highs between the actual swing point high and new swing point high would be counted as potential swing point highs.

If there was an actual swing point high 7-bars prior to the the new swing point high, than we could use the following formula:

H5 * ABS(MAXH2.6 < H5 AND H5 > MAXH5)

If there was an actual swing point high 8-bars pior to the new swing point high, then we could use the following formula:

H5 * ABS(MAXH3.6 < H5 AND H5 > MAXH5)

If there was an actual swing point high 9-bars pior to the new swing point high, then we could use the following formula:

H5 * ABS(MAXH4.6 < H5 AND H5 > MAXH5)

If the last actual swing point high was 10-bars or more pior to the new swing point high, then we could use the following formula:

H5 * ABS(MAXH5.6 < H5 AND H5 > MAXH5)

So we have five possibilities as to the requirements of a swing point high depending on how long ago the most recent actual swing bar high occurred. So a hypothetical (non-working) formula for this would be:

H5 * ABS(((SPH11 AND H6 < H5) OR (SPH12 AND MAXH2.6 < H5) OR (SPH13 AND MAXH3.6 < H5) OR (SPH14 AND MAXH4.6 < H5) OR MAXH5.6 < H5) AND H5 > MAXH5)

Unfortunately, to actually create this formula, we would need to somehow substitute bars ago versions of the formula we just created into itself to replace all of the SPHs in the formula that represent previous swing point highs. Since there really isn't a way to create an infinitely recursive function in the Personal Criteria Formula Language, I do not see this as being possible.

About the closest we could come would be to substitute in either the least restrictive:

H5 * ABS(((H12 < H11 AND H11 > MAXH5.6 AND H6 < H5) OR (H13 < H12 AND H12 > MAXH5.7 AND MAXH2.6 < H5) OR (H14 < H13 AND H13 > MAXH5.8 AND MAXH3.6 < H5) OR (H15 < H14 AND H14 > MAXH5.9 AND MAXH4.6 < H5) OR MAXH5.6 < H5) AND H5 > MAXH5)

Or most restrictive standalone swing point high formulas and hope one or the other is good enough:

H5 * ABS(((MAXH5.12 < H11 AND H11 > MAXH5.6 AND H6 < H5) OR (MAXH5.13 < H12 AND H12 > MAXH5.7 AND MAXH2.6 < H5) OR (MAXH5.14 < H13 AND H13 > MAXH5.8 AND MAXH3.6 < H5) OR (MAXH5.15 < H14 AND H14 > MAXH5.9 AND MAXH4.6 < H5) OR MAXH5.6 < H5) AND H5 > MAXH5)

The least restrictive version of the swing point low formula would be:

L5 * ABS(((L12 > L11 AND L11 < MINL5.6 AND L6 > L5) OR (L13 > L12 AND L12 < MINL5.7 AND MINL2.6 > L5) OR (L14 > L13 AND L13 < MINL5.8 AND MINL3.6 > L5) OR (L15 > L14 AND L14 < MINL5.9 AND MINL4.6 > L5) OR MINL5.6 > L5) AND L5 < MINL5)

And the most restrictive version of the swing point low formula would be:

L5 * ABS(((MINL5.12 > L11 AND L11 < MINL5.6 AND L6 > L5) OR (MINL5.13 > L12 AND L12 < MINL5.7 AND MINL2.6 > L5) OR (MINL5.14 > L13 AND L13 < MINL5.8 AND MINL3.6 > L5) OR (MINL5.15 > L14 AND L14 < MINL5.9 AND MINL4.6 > L5) OR MINL5.6 > L5) AND L5 < MINL5)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Thursday, January 17, 2013 3:26:01 PM
Registered User
Joined: 1/28/2012
Posts: 62

Thanks for the research and revised take on this problem, Bruce. My understanding is a bit different.

For clarity, lets create 11 data points, starting with today and moving back:

H = $1, H1 = $1, H2 = $1, H3 = $1, H4 = $1, H5 = $2, H6 = $3, H7 = $1, H8 = $1, H9 = $1, H10 = $1, H11 = $4 

In this scenario, H1 and H11 are both Swing Point Highs (SPHs),  because they are followed by 5 bars each with lower highs. Note that H6 is higher than H5, but is prevented from being a PSPH by the 5 bar rule. Thus, your first modified formula doesn't fit the spec.

While it's easy enough to find and label H5 as an SPH (thanks for that), those pesky prior bars continue to bother me. The way I see it, we don't have to go any further back than H11... if we can find a way to program it (where's an IF... THEN conditional statement for PCFs when we need one?).

I'm hoping that an infinite recursive function isn't necessary if, six days ago, H11 was captured as an H5 SPH. If so, that takes care of half the problem.

The other half is when H11 is NOT an SPH. Suppose H11 = $1. Then, the $3 day (H6 above) definitely would be an SPH and the current $2 day (H5 above) would not.

I'm really not good enough at PCFs to wrap my head around this. I thought that, if we had two separate conditions and no IF... THEN statement, is it possible to write something along the lines of H5 * (ABS(.....) AND ABS(.....))?

For another illustration of the phenomenon, Little himself uses the SPY monthly chart from March 1, 2002 to Apr. 30, 2006. Our existing formula captures SPLs on Oct. 2002 and Aug. 2004. There's just one SPH, in Mar. 2004. Little's chart agrees with those, but has 4 more SPLs: Apr. 2003, Oct. 2003, Apr. 2005 and Oct. 2005. 

Thanks, Bruce. You're a patient guy.

 

Bruce_L
Posted : Thursday, January 17, 2013 4:34:23 PM


Worden Trainer

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

If you do something like the following, you will get the swing point highs and lows you want marked, but you will also get extra bars marked because the results are not recursive.

Swing Point High:

H5 * ABS(H5 > MAXH5 AND (H11 > MAXH5.6 OR H5 > MAXH5.6))

Swing Point Low:

L5 * ABS(L5 < MINL5 AND (L11 < MINL5.6 OR L5 < MINL5.6))

When March 2003 is processed, the bar knows it can't be as swing point low because October 2002 is a swing point low. But when September 2003 is processed, it has no idea that previous swing point low was in April 2003 instead of March 2003, so September 2003 and October 2003 both get marked. The formula even thinks that May of 2003 was potentially a swing point low (it is after all followed by five higher lows), so November 2003 gets marked as well.

The inability to recursively apply the swing point high and swing point low definitions to the prior swing point highs and lows pretty much makes it impossible to create the formulas. You can do so with a state machine that processes the data from left to right, but you cannot duplicate the results with a formula language that is not recursive.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Thursday, January 17, 2013 11:09:23 PM
Registered User
Joined: 1/28/2012
Posts: 62

Yikes! I tried your formulas on the SPY monthly and see what you mean. 

So, we're stuck with not capturing some of the swing points or having false swing points all over the place.

Little looks at screens with about 60 bars in any time frame. Sometimes (during super-strong trends, for example) it's necessary to go back a bit further to find a swing point, since we need 2 SPHs and 2 SPLs to establish trend direction and strength.

Would it be possible to short-circuit the recursive problem by starting say 100 bars back and working left-to-right, forward in time?

(Does Real Code handle recursive? From other comments I've seen on this board, users are hoping that Worden finds a way to offer it without turning maniacs like me loose in your servers. It would probably make your work a lot easier, too.)

Thanks, again.

 

Bruce_L
Posted : Friday, January 18, 2013 8:58:13 AM


Worden Trainer

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

Any sort of Personal Criteria Formula attempting to look back 100-bars for this would be way too long and slow to be practical or post in the forums. Starting from the left and going forward instead of starting from the right and going backward would not provide any advantages as the PCF language does not have variables into which you can store the results. Every possible branch needs to be completed contained within the PCF.

The RealCode for this would appear to be straightforward. A RealCode Indicator for a swing point high could be written as:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Swing Point High
'|******************************************************************
'# Period = UserInput.Integer = 5
Static Potential As Integer
If isFirstBar Then
	Potential = 0
End If
Dim Offset As Integer = CurrentIndex - Potential
If Offset > Period Then
	AddToOutput(Price.DateValue(Offset), Price.High(Offset))
	Potential = CurrentIndex
Else If Price.High > Price.High(Offset) Then
	Potential = CurrentIndex
End If
Plot = Single.NaN

While a RealCode Indicator for a swing point low could be written as:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Swing Point Low
'|******************************************************************
'# Period = UserInput.Integer = 5
Static Potential As Integer
If isFirstBar Then
	Potential = 0
End If
Dim Offset As Integer = CurrentIndex - Potential
If Offset > Period Then
	AddToOutput(Price.DateValue(Offset), Price.Low(Offset))
	Potential = CurrentIndex
Else If Price.Low < Price.Low(Offset) Then
	Potential = CurrentIndex
End If
Plot = Single.NaN

Interestingly enough, there is an extra swing point high in June 2002 when viewing a monthly chart for SPY covering March 2002 through April 2006. The reason for this is that there is a cycle of swing point highs in the midst of a downtrend on an actual local maxima on March 2000 and continuing with September 2000, May 2001, December 2001 and June 2002.

These swing point highs in a downtrend differ from swing point highs requiring lower highs on both sides of the swing point high in that their existence is dependent on the bar used to start the calculations of the swing point highs.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Friday, January 18, 2013 9:18:38 AM
Registered User
Joined: 1/28/2012
Posts: 62

Wow! This just gets weirder and weirder, Bruce.

I'm going to do 3 things:

1) Revert to the original Nov. 14 formula, adjusted to H5 instead of H6.

2) Write to L.A. Little about the proliferation and value of odd middle-of-nowhere swing points.

3) Feedback to Worden about somehow getting Real Code available for TC2000 users. (On the technical side, is it possible to house the Real Code engine on our computers and simply access the data from Worden?) 

Thanks again for the help.

Bruce_L
Posted : Friday, January 18, 2013 9:38:31 AM


Worden Trainer

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

Just a note that the starting point used to test for a swing point high surrounded on both sides by lower highs can also cause a difference in where swing point highs occur. But this only happens when the swing point high is so close to the start of the data being checked that you cannot actually check for the lower prior highs. This does not cause the location of subsequent swing point highs to change and does not cause swing point highs in a downtrend as can happen with method you described.

Thank you for your suggestion. It has been assigned case number 9927.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
geolinas
Posted : Wednesday, July 29, 2015 8:28:26 AM
Registered User
Joined: 5/28/2014
Posts: 26

Hi! Very useful the LA Little formula. I am wondering if I could have a PCF with the percentage difference of the last close to the LAST swing high and low. Thanks in advance..

Bruce_L
Posted : Wednesday, July 29, 2015 10:35:56 AM


Worden Trainer

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

There are quite a few different formulas given for swing point lows and swing point highs. Which ones do you want to use?



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
geolinas
Posted : Wednesday, July 29, 2015 10:56:04 AM
Registered User
Joined: 5/28/2014
Posts: 26

For swing high I use the formula: H6 * ABS(H6 > MAXH6.7 AND H6 > MAXH6)

Bruce_L
Posted : Wednesday, July 29, 2015 2:45:25 PM


Worden Trainer

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

In Indicator Formula for the percent change since the most recent identifiable swing high checking back 100 bars can be written as follows.

100 * (C / (ABS(MAXH6 < H6 AND H6 > MAXH6.7) * H6 + ABS(MAXH6 >= H6 OR H6 <= MAXH6.7) * (ABS(MAXH6.1 < H7 AND H7 > MAXH6.8) * H7 + ABS(MAXH6.1 >= H7 OR H7 <= MAXH6.8) * (ABS(MAXH6.2 < H8 AND H8 > MAXH6.9) * H8 + ABS(MAXH6.2 >= H8 OR H8 <= MAXH6.9) * (ABS(MAXH6.3 < H9 AND H9 > MAXH6.10) * H9 + ABS(MAXH6.3 >= H9 OR H9 <= MAXH6.10) * (ABS(MAXH6.4 < H10 AND H10 > MAXH6.11) * H10 + ABS(MAXH6.4 >= H10 OR H10 <= MAXH6.11) * (ABS(MAXH6.5 < H11 AND H11 > MAXH6.12) * H11 + ABS(MAXH6.5 >= H11 OR H11 <= MAXH6.12) * (ABS(MAXH6.6 < H12 AND H12 > MAXH6.13) * H12 + ABS(MAXH6.6 >= H12 OR H12 <= MAXH6.13) * (ABS(MAXH6.7 < H13 AND H13 > MAXH6.14) * H13 + ABS(MAXH6.7 >= H13 OR H13 <= MAXH6.14) * (ABS(MAXH6.8 < H14 AND H14 > MAXH6.15) * H14 + ABS(MAXH6.8 >= H14 OR H14 <= MAXH6.15) * (ABS(MAXH6.9 < H15 AND H15 > MAXH6.16) * H15 + ABS(MAXH6.9 >= H15 OR H15 <= MAXH6.16) * (ABS(MAXH6.10 < H16 AND H16 > MAXH6.17) * H16 + ABS(MAXH6.10 >= H16 OR H16 <= MAXH6.17) * (ABS(MAXH6.11 < H17 AND H17 > MAXH6.18) * H17 + ABS(MAXH6.11 >= H17 OR H17 <= MAXH6.18) * (ABS(MAXH6.12 < H18 AND H18 > MAXH6.19) * H18 + ABS(MAXH6.12 >= H18 OR H18 <= MAXH6.19) * (ABS(MAXH6.13 < H19 AND H19 > MAXH6.20) * H19 + ABS(MAXH6.13 >= H19 OR H19 <= MAXH6.20) * (ABS(MAXH6.14 < H20 AND H20 > MAXH6.21) * H20 + ABS(MAXH6.14 >= H20 OR H20 <= MAXH6.21) * (ABS(MAXH6.15 < H21 AND H21 > MAXH6.22) * H21 + ABS(MAXH6.15 >= H21 OR H21 <= MAXH6.22) * (ABS(MAXH6.16 < H22 AND H22 > MAXH6.23) * H22 + ABS(MAXH6.16 >= H22 OR H22 <= MAXH6.23) * (ABS(MAXH6.17 < H23 AND H23 > MAXH6.24) * H23 + ABS(MAXH6.17 >= H23 OR H23 <= MAXH6.24) * (ABS(MAXH6.18 < H24 AND H24 > MAXH6.25) * H24 + ABS(MAXH6.18 >= H24 OR H24 <= MAXH6.25) * (ABS(MAXH6.19 < H25 AND H25 > MAXH6.26) * H25 + ABS(MAXH6.19 >= H25 OR H25 <= MAXH6.26) * (ABS(MAXH6.20 < H26 AND H26 > MAXH6.27) * H26 + ABS(MAXH6.20 >= H26 OR H26 <= MAXH6.27) * (ABS(MAXH6.21 < H27 AND H27 > MAXH6.28) * H27 + ABS(MAXH6.21 >= H27 OR H27 <= MAXH6.28) * (ABS(MAXH6.22 < H28 AND H28 > MAXH6.29) * H28 + ABS(MAXH6.22 >= H28 OR H28 <= MAXH6.29) * (ABS(MAXH6.23 < H29 AND H29 > MAXH6.30) * H29 + ABS(MAXH6.23 >= H29 OR H29 <= MAXH6.30) * (ABS(MAXH6.24 < H30 AND H30 > MAXH6.31) * H30 + ABS(MAXH6.24 >= H30 OR H30 <= MAXH6.31) * (ABS(MAXH6.25 < H31 AND H31 > MAXH6.32) * H31 + ABS(MAXH6.25 >= H31 OR H31 <= MAXH6.32) * (ABS(MAXH6.26 < H32 AND H32 > MAXH6.33) * H32 + ABS(MAXH6.26 >= H32 OR H32 <= MAXH6.33) * (ABS(MAXH6.27 < H33 AND H33 > MAXH6.34) * H33 + ABS(MAXH6.27 >= H33 OR H33 <= MAXH6.34) * (ABS(MAXH6.28 < H34 AND H34 > MAXH6.35) * H34 + ABS(MAXH6.28 >= H34 OR H34 <= MAXH6.35) * (ABS(MAXH6.29 < H35 AND H35 > MAXH6.36) * H35 + ABS(MAXH6.29 >= H35 OR H35 <= MAXH6.36) * (ABS(MAXH6.30 < H36 AND H36 > MAXH6.37) * H36 + ABS(MAXH6.30 >= H36 OR H36 <= MAXH6.37) * (ABS(MAXH6.31 < H37 AND H37 > MAXH6.38) * H37 + ABS(MAXH6.31 >= H37 OR H37 <= MAXH6.38) * (ABS(MAXH6.32 < H38 AND H38 > MAXH6.39) * H38 + ABS(MAXH6.32 >= H38 OR H38 <= MAXH6.39) * (ABS(MAXH6.33 < H39 AND H39 > MAXH6.40) * H39 + ABS(MAXH6.33 >= H39 OR H39 <= MAXH6.40) * (ABS(MAXH6.34 < H40 AND H40 > MAXH6.41) * H40 + ABS(MAXH6.34 >= H40 OR H40 <= MAXH6.41) * (ABS(MAXH6.35 < H41 AND H41 > MAXH6.42) * H41 + ABS(MAXH6.35 >= H41 OR H41 <= MAXH6.42) * (ABS(MAXH6.36 < H42 AND H42 > MAXH6.43) * H42 + ABS(MAXH6.36 >= H42 OR H42 <= MAXH6.43) * (ABS(MAXH6.37 < H43 AND H43 > MAXH6.44) * H43 + ABS(MAXH6.37 >= H43 OR H43 <= MAXH6.44) * (ABS(MAXH6.38 < H44 AND H44 > MAXH6.45) * H44 + ABS(MAXH6.38 >= H44 OR H44 <= MAXH6.45) * (ABS(MAXH6.39 < H45 AND H45 > MAXH6.46) * H45 + ABS(MAXH6.39 >= H45 OR H45 <= MAXH6.46) * (ABS(MAXH6.40 < H46 AND H46 > MAXH6.47) * H46 + ABS(MAXH6.40 >= H46 OR H46 <= MAXH6.47) * (ABS(MAXH6.41 < H47 AND H47 > MAXH6.48) * H47 + ABS(MAXH6.41 >= H47 OR H47 <= MAXH6.48) * (ABS(MAXH6.42 < H48 AND H48 > MAXH6.49) * H48 + ABS(MAXH6.42 >= H48 OR H48 <= MAXH6.49) * (ABS(MAXH6.43 < H49 AND H49 > MAXH6.50) * H49 + ABS(MAXH6.43 >= H49 OR H49 <= MAXH6.50) * (ABS(MAXH6.44 < H50 AND H50 > MAXH6.51) * H50 + ABS(MAXH6.44 >= H50 OR H50 <= MAXH6.51) * (ABS(MAXH6.45 < H51 AND H51 > MAXH6.52) * H51 + ABS(MAXH6.45 >= H51 OR H51 <= MAXH6.52) * (ABS(MAXH6.46 < H52 AND H52 > MAXH6.53) * H52 + ABS(MAXH6.46 >= H52 OR H52 <= MAXH6.53) * (ABS(MAXH6.47 < H53 AND H53 > MAXH6.54) * H53 + ABS(MAXH6.47 >= H53 OR H53 <= MAXH6.54) * (ABS(MAXH6.48 < H54 AND H54 > MAXH6.55) * H54 + ABS(MAXH6.48 >= H54 OR H54 <= MAXH6.55) * (ABS(MAXH6.49 < H55 AND H55 > MAXH6.56) * H55 + ABS(MAXH6.49 >= H55 OR H55 <= MAXH6.56) * (ABS(MAXH6.50 < H56 AND H56 > MAXH6.57) * H56 + ABS(MAXH6.50 >= H56 OR H56 <= MAXH6.57) * (ABS(MAXH6.51 < H57 AND H57 > MAXH6.58) * H57 + ABS(MAXH6.51 >= H57 OR H57 <= MAXH6.58) * (ABS(MAXH6.52 < H58 AND H58 > MAXH6.59) * H58 + ABS(MAXH6.52 >= H58 OR H58 <= MAXH6.59) * (ABS(MAXH6.53 < H59 AND H59 > MAXH6.60) * H59 + ABS(MAXH6.53 >= H59 OR H59 <= MAXH6.60) * (ABS(MAXH6.54 < H60 AND H60 > MAXH6.61) * H60 + ABS(MAXH6.54 >= H60 OR H60 <= MAXH6.61) * (ABS(MAXH6.55 < H61 AND H61 > MAXH6.62) * H61 + ABS(MAXH6.55 >= H61 OR H61 <= MAXH6.62) * (ABS(MAXH6.56 < H62 AND H62 > MAXH6.63) * H62 + ABS(MAXH6.56 >= H62 OR H62 <= MAXH6.63) * (ABS(MAXH6.57 < H63 AND H63 > MAXH6.64) * H63 + ABS(MAXH6.57 >= H63 OR H63 <= MAXH6.64) * (ABS(MAXH6.58 < H64 AND H64 > MAXH6.65) * H64 + ABS(MAXH6.58 >= H64 OR H64 <= MAXH6.65) * (ABS(MAXH6.59 < H65 AND H65 > MAXH6.66) * H65 + ABS(MAXH6.59 >= H65 OR H65 <= MAXH6.66) * (ABS(MAXH6.60 < H66 AND H66 > MAXH6.67) * H66 + ABS(MAXH6.60 >= H66 OR H66 <= MAXH6.67) * (ABS(MAXH6.61 < H67 AND H67 > MAXH6.68) * H67 + ABS(MAXH6.61 >= H67 OR H67 <= MAXH6.68) * (ABS(MAXH6.62 < H68 AND H68 > MAXH6.69) * H68 + ABS(MAXH6.62 >= H68 OR H68 <= MAXH6.69) * (ABS(MAXH6.63 < H69 AND H69 > MAXH6.70) * H69 + ABS(MAXH6.63 >= H69 OR H69 <= MAXH6.70) * (ABS(MAXH6.64 < H70 AND H70 > MAXH6.71) * H70 + ABS(MAXH6.64 >= H70 OR H70 <= MAXH6.71) * (ABS(MAXH6.65 < H71 AND H71 > MAXH6.72) * H71 + ABS(MAXH6.65 >= H71 OR H71 <= MAXH6.72) * (ABS(MAXH6.66 < H72 AND H72 > MAXH6.73) * H72 + ABS(MAXH6.66 >= H72 OR H72 <= MAXH6.73) * (ABS(MAXH6.67 < H73 AND H73 > MAXH6.74) * H73 + ABS(MAXH6.67 >= H73 OR H73 <= MAXH6.74) * (ABS(MAXH6.68 < H74 AND H74 > MAXH6.75) * H74 + ABS(MAXH6.68 >= H74 OR H74 <= MAXH6.75) * (ABS(MAXH6.69 < H75 AND H75 > MAXH6.76) * H75 + ABS(MAXH6.69 >= H75 OR H75 <= MAXH6.76) * (ABS(MAXH6.70 < H76 AND H76 > MAXH6.77) * H76 + ABS(MAXH6.70 >= H76 OR H76 <= MAXH6.77) * (ABS(MAXH6.71 < H77 AND H77 > MAXH6.78) * H77 + ABS(MAXH6.71 >= H77 OR H77 <= MAXH6.78) * (ABS(MAXH6.72 < H78 AND H78 > MAXH6.79) * H78 + ABS(MAXH6.72 >= H78 OR H78 <= MAXH6.79) * (ABS(MAXH6.73 < H79 AND H79 > MAXH6.80) * H79 + ABS(MAXH6.73 >= H79 OR H79 <= MAXH6.80) * (ABS(MAXH6.74 < H80 AND H80 > MAXH6.81) * H80 + ABS(MAXH6.74 >= H80 OR H80 <= MAXH6.81) * (ABS(MAXH6.75 < H81 AND H81 > MAXH6.82) * H81 + ABS(MAXH6.75 >= H81 OR H81 <= MAXH6.82) * (ABS(MAXH6.76 < H82 AND H82 > MAXH6.83) * H82 + ABS(MAXH6.76 >= H82 OR H82 <= MAXH6.83) * (ABS(MAXH6.77 < H83 AND H83 > MAXH6.84) * H83 + ABS(MAXH6.77 >= H83 OR H83 <= MAXH6.84) * (ABS(MAXH6.78 < H84 AND H84 > MAXH6.85) * H84 + ABS(MAXH6.78 >= H84 OR H84 <= MAXH6.85) * (ABS(MAXH6.79 < H85 AND H85 > MAXH6.86) * H85 + ABS(MAXH6.79 >= H85 OR H85 <= MAXH6.86) * (ABS(MAXH6.80 < H86 AND H86 > MAXH6.87) * H86 + ABS(MAXH6.80 >= H86 OR H86 <= MAXH6.87) * (ABS(MAXH6.81 < H87 AND H87 > MAXH6.88) * H87 + ABS(MAXH6.81 >= H87 OR H87 <= MAXH6.88) * (ABS(MAXH6.82 < H88 AND H88 > MAXH6.89) * H88 + ABS(MAXH6.82 >= H88 OR H88 <= MAXH6.89) * (ABS(MAXH6.83 < H89 AND H89 > MAXH6.90) * H89 + ABS(MAXH6.83 >= H89 OR H89 <= MAXH6.90) * (ABS(MAXH6.84 < H90 AND H90 > MAXH6.91) * H90 + ABS(MAXH6.84 >= H90 OR H90 <= MAXH6.91) * (ABS(MAXH6.85 < H91 AND H91 > MAXH6.92) * H91 + ABS(MAXH6.85 >= H91 OR H91 <= MAXH6.92) * (ABS(MAXH6.86 < H92 AND H92 > MAXH6.93) * H92 + ABS(MAXH6.86 >= H92 OR H92 <= MAXH6.93) * (ABS(MAXH6.87 < H93 AND H93 > MAXH6.94) * H93 + ABS(MAXH6.87 >= H93 OR H93 <= MAXH6.94) * (ABS(MAXH6.88 < H94 AND H94 > MAXH6.95) * H94 + ABS(MAXH6.88 >= H94 OR H94 <= MAXH6.95) * (ABS(MAXH6.89 < H95 AND H95 > MAXH6.96) * H95 + ABS(MAXH6.89 >= H95 OR H95 <= MAXH6.96) * (ABS(MAXH6.90 < H96 AND H96 > MAXH6.97) * H96 + ABS(MAXH6.90 >= H96 OR H96 <= MAXH6.97) * (ABS(MAXH6.91 < H97 AND H97 > MAXH6.98) * H97 + ABS(MAXH6.91 >= H97 OR H97 <= MAXH6.98) * (ABS(MAXH6.92 < H98 AND H98 > MAXH6.99) * H98 + ABS(MAXH6.92 >= H98 OR H98 <= MAXH6.99) * (ABS(MAXH6.93 < H99 AND H99 > MAXH6.100) * H99 + ABS(MAXH6.93 >= H99 OR H99 <= MAXH6.100) * (ABS(MAXH6.94 < H100 AND H100 > MAXH6.101) * H100 + ABS(MAXH6.94 >= H100 OR H100 <= MAXH6.101) * (ABS(MAXH6.95 < H101 AND H101 > MAXH6.102) * H101 + ABS(MAXH6.95 >= H101 OR H101 <= MAXH6.102) * (ABS(MAXH6.96 < H102 AND H102 > MAXH6.103) * H102 + ABS(MAXH6.96 >= H102 OR H102 <= MAXH6.103) * (ABS(MAXH6.97 < H103 AND H103 > MAXH6.104) * H103 + ABS(MAXH6.97 >= H103 OR H103 <= MAXH6.104) * (ABS(MAXH6.98 < H104 AND H104 > MAXH6.105) * H104 + ABS(MAXH6.98 >= H104 OR H104 <= MAXH6.105) * (ABS(MAXH6.99 < H105 AND H105 > MAXH6.106) * H105 + ABS(MAXH6.99 >= H105 OR H105 <= MAXH6.106) * MAXH106)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - 1)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Bruce_L
Posted : Wednesday, July 29, 2015 2:48:40 PM


Worden Trainer

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

In Indicator Formula for the percent change since the most recent identifiable swing low checking back 100 bars can be written as follows.

100 * (C / (ABS(MINL6 > L6 AND L6 < MINL6.7) * L6 + ABS(MINL6 <= L6 OR L6 >= MINL6.7) * (ABS(MINL6.1 > L7 AND L7 < MINL6.8) * L7 + ABS(MINL6.1 <= L7 OR L7 >= MINL6.8) * (ABS(MINL6.2 > L8 AND L8 < MINL6.9) * L8 + ABS(MINL6.2 <= L8 OR L8 >= MINL6.9) * (ABS(MINL6.3 > L9 AND L9 < MINL6.10) * L9 + ABS(MINL6.3 <= L9 OR L9 >= MINL6.10) * (ABS(MINL6.4 > L10 AND L10 < MINL6.11) * L10 + ABS(MINL6.4 <= L10 OR L10 >= MINL6.11) * (ABS(MINL6.5 > L11 AND L11 < MINL6.12) * L11 + ABS(MINL6.5 <= L11 OR L11 >= MINL6.12) * (ABS(MINL6.6 > L12 AND L12 < MINL6.13) * L12 + ABS(MINL6.6 <= L12 OR L12 >= MINL6.13) * (ABS(MINL6.7 > L13 AND L13 < MINL6.14) * L13 + ABS(MINL6.7 <= L13 OR L13 >= MINL6.14) * (ABS(MINL6.8 > L14 AND L14 < MINL6.15) * L14 + ABS(MINL6.8 <= L14 OR L14 >= MINL6.15) * (ABS(MINL6.9 > L15 AND L15 < MINL6.16) * L15 + ABS(MINL6.9 <= L15 OR L15 >= MINL6.16) * (ABS(MINL6.10 > L16 AND L16 < MINL6.17) * L16 + ABS(MINL6.10 <= L16 OR L16 >= MINL6.17) * (ABS(MINL6.11 > L17 AND L17 < MINL6.18) * L17 + ABS(MINL6.11 <= L17 OR L17 >= MINL6.18) * (ABS(MINL6.12 > L18 AND L18 < MINL6.19) * L18 + ABS(MINL6.12 <= L18 OR L18 >= MINL6.19) * (ABS(MINL6.13 > L19 AND L19 < MINL6.20) * L19 + ABS(MINL6.13 <= L19 OR L19 >= MINL6.20) * (ABS(MINL6.14 > L20 AND L20 < MINL6.21) * L20 + ABS(MINL6.14 <= L20 OR L20 >= MINL6.21) * (ABS(MINL6.15 > L21 AND L21 < MINL6.22) * L21 + ABS(MINL6.15 <= L21 OR L21 >= MINL6.22) * (ABS(MINL6.16 > L22 AND L22 < MINL6.23) * L22 + ABS(MINL6.16 <= L22 OR L22 >= MINL6.23) * (ABS(MINL6.17 > L23 AND L23 < MINL6.24) * L23 + ABS(MINL6.17 <= L23 OR L23 >= MINL6.24) * (ABS(MINL6.18 > L24 AND L24 < MINL6.25) * L24 + ABS(MINL6.18 <= L24 OR L24 >= MINL6.25) * (ABS(MINL6.19 > L25 AND L25 < MINL6.26) * L25 + ABS(MINL6.19 <= L25 OR L25 >= MINL6.26) * (ABS(MINL6.20 > L26 AND L26 < MINL6.27) * L26 + ABS(MINL6.20 <= L26 OR L26 >= MINL6.27) * (ABS(MINL6.21 > L27 AND L27 < MINL6.28) * L27 + ABS(MINL6.21 <= L27 OR L27 >= MINL6.28) * (ABS(MINL6.22 > L28 AND L28 < MINL6.29) * L28 + ABS(MINL6.22 <= L28 OR L28 >= MINL6.29) * (ABS(MINL6.23 > L29 AND L29 < MINL6.30) * L29 + ABS(MINL6.23 <= L29 OR L29 >= MINL6.30) * (ABS(MINL6.24 > L30 AND L30 < MINL6.31) * L30 + ABS(MINL6.24 <= L30 OR L30 >= MINL6.31) * (ABS(MINL6.25 > L31 AND L31 < MINL6.32) * L31 + ABS(MINL6.25 <= L31 OR L31 >= MINL6.32) * (ABS(MINL6.26 > L32 AND L32 < MINL6.33) * L32 + ABS(MINL6.26 <= L32 OR L32 >= MINL6.33) * (ABS(MINL6.27 > L33 AND L33 < MINL6.34) * L33 + ABS(MINL6.27 <= L33 OR L33 >= MINL6.34) * (ABS(MINL6.28 > L34 AND L34 < MINL6.35) * L34 + ABS(MINL6.28 <= L34 OR L34 >= MINL6.35) * (ABS(MINL6.29 > L35 AND L35 < MINL6.36) * L35 + ABS(MINL6.29 <= L35 OR L35 >= MINL6.36) * (ABS(MINL6.30 > L36 AND L36 < MINL6.37) * L36 + ABS(MINL6.30 <= L36 OR L36 >= MINL6.37) * (ABS(MINL6.31 > L37 AND L37 < MINL6.38) * L37 + ABS(MINL6.31 <= L37 OR L37 >= MINL6.38) * (ABS(MINL6.32 > L38 AND L38 < MINL6.39) * L38 + ABS(MINL6.32 <= L38 OR L38 >= MINL6.39) * (ABS(MINL6.33 > L39 AND L39 < MINL6.40) * L39 + ABS(MINL6.33 <= L39 OR L39 >= MINL6.40) * (ABS(MINL6.34 > L40 AND L40 < MINL6.41) * L40 + ABS(MINL6.34 <= L40 OR L40 >= MINL6.41) * (ABS(MINL6.35 > L41 AND L41 < MINL6.42) * L41 + ABS(MINL6.35 <= L41 OR L41 >= MINL6.42) * (ABS(MINL6.36 > L42 AND L42 < MINL6.43) * L42 + ABS(MINL6.36 <= L42 OR L42 >= MINL6.43) * (ABS(MINL6.37 > L43 AND L43 < MINL6.44) * L43 + ABS(MINL6.37 <= L43 OR L43 >= MINL6.44) * (ABS(MINL6.38 > L44 AND L44 < MINL6.45) * L44 + ABS(MINL6.38 <= L44 OR L44 >= MINL6.45) * (ABS(MINL6.39 > L45 AND L45 < MINL6.46) * L45 + ABS(MINL6.39 <= L45 OR L45 >= MINL6.46) * (ABS(MINL6.40 > L46 AND L46 < MINL6.47) * L46 + ABS(MINL6.40 <= L46 OR L46 >= MINL6.47) * (ABS(MINL6.41 > L47 AND L47 < MINL6.48) * L47 + ABS(MINL6.41 <= L47 OR L47 >= MINL6.48) * (ABS(MINL6.42 > L48 AND L48 < MINL6.49) * L48 + ABS(MINL6.42 <= L48 OR L48 >= MINL6.49) * (ABS(MINL6.43 > L49 AND L49 < MINL6.50) * L49 + ABS(MINL6.43 <= L49 OR L49 >= MINL6.50) * (ABS(MINL6.44 > L50 AND L50 < MINL6.51) * L50 + ABS(MINL6.44 <= L50 OR L50 >= MINL6.51) * (ABS(MINL6.45 > L51 AND L51 < MINL6.52) * L51 + ABS(MINL6.45 <= L51 OR L51 >= MINL6.52) * (ABS(MINL6.46 > L52 AND L52 < MINL6.53) * L52 + ABS(MINL6.46 <= L52 OR L52 >= MINL6.53) * (ABS(MINL6.47 > L53 AND L53 < MINL6.54) * L53 + ABS(MINL6.47 <= L53 OR L53 >= MINL6.54) * (ABS(MINL6.48 > L54 AND L54 < MINL6.55) * L54 + ABS(MINL6.48 <= L54 OR L54 >= MINL6.55) * (ABS(MINL6.49 > L55 AND L55 < MINL6.56) * L55 + ABS(MINL6.49 <= L55 OR L55 >= MINL6.56) * (ABS(MINL6.50 > L56 AND L56 < MINL6.57) * L56 + ABS(MINL6.50 <= L56 OR L56 >= MINL6.57) * (ABS(MINL6.51 > L57 AND L57 < MINL6.58) * L57 + ABS(MINL6.51 <= L57 OR L57 >= MINL6.58) * (ABS(MINL6.52 > L58 AND L58 < MINL6.59) * L58 + ABS(MINL6.52 <= L58 OR L58 >= MINL6.59) * (ABS(MINL6.53 > L59 AND L59 < MINL6.60) * L59 + ABS(MINL6.53 <= L59 OR L59 >= MINL6.60) * (ABS(MINL6.54 > L60 AND L60 < MINL6.61) * L60 + ABS(MINL6.54 <= L60 OR L60 >= MINL6.61) * (ABS(MINL6.55 > L61 AND L61 < MINL6.62) * L61 + ABS(MINL6.55 <= L61 OR L61 >= MINL6.62) * (ABS(MINL6.56 > L62 AND L62 < MINL6.63) * L62 + ABS(MINL6.56 <= L62 OR L62 >= MINL6.63) * (ABS(MINL6.57 > L63 AND L63 < MINL6.64) * L63 + ABS(MINL6.57 <= L63 OR L63 >= MINL6.64) * (ABS(MINL6.58 > L64 AND L64 < MINL6.65) * L64 + ABS(MINL6.58 <= L64 OR L64 >= MINL6.65) * (ABS(MINL6.59 > L65 AND L65 < MINL6.66) * L65 + ABS(MINL6.59 <= L65 OR L65 >= MINL6.66) * (ABS(MINL6.60 > L66 AND L66 < MINL6.67) * L66 + ABS(MINL6.60 <= L66 OR L66 >= MINL6.67) * (ABS(MINL6.61 > L67 AND L67 < MINL6.68) * L67 + ABS(MINL6.61 <= L67 OR L67 >= MINL6.68) * (ABS(MINL6.62 > L68 AND L68 < MINL6.69) * L68 + ABS(MINL6.62 <= L68 OR L68 >= MINL6.69) * (ABS(MINL6.63 > L69 AND L69 < MINL6.70) * L69 + ABS(MINL6.63 <= L69 OR L69 >= MINL6.70) * (ABS(MINL6.64 > L70 AND L70 < MINL6.71) * L70 + ABS(MINL6.64 <= L70 OR L70 >= MINL6.71) * (ABS(MINL6.65 > L71 AND L71 < MINL6.72) * L71 + ABS(MINL6.65 <= L71 OR L71 >= MINL6.72) * (ABS(MINL6.66 > L72 AND L72 < MINL6.73) * L72 + ABS(MINL6.66 <= L72 OR L72 >= MINL6.73) * (ABS(MINL6.67 > L73 AND L73 < MINL6.74) * L73 + ABS(MINL6.67 <= L73 OR L73 >= MINL6.74) * (ABS(MINL6.68 > L74 AND L74 < MINL6.75) * L74 + ABS(MINL6.68 <= L74 OR L74 >= MINL6.75) * (ABS(MINL6.69 > L75 AND L75 < MINL6.76) * L75 + ABS(MINL6.69 <= L75 OR L75 >= MINL6.76) * (ABS(MINL6.70 > L76 AND L76 < MINL6.77) * L76 + ABS(MINL6.70 <= L76 OR L76 >= MINL6.77) * (ABS(MINL6.71 > L77 AND L77 < MINL6.78) * L77 + ABS(MINL6.71 <= L77 OR L77 >= MINL6.78) * (ABS(MINL6.72 > L78 AND L78 < MINL6.79) * L78 + ABS(MINL6.72 <= L78 OR L78 >= MINL6.79) * (ABS(MINL6.73 > L79 AND L79 < MINL6.80) * L79 + ABS(MINL6.73 <= L79 OR L79 >= MINL6.80) * (ABS(MINL6.74 > L80 AND L80 < MINL6.81) * L80 + ABS(MINL6.74 <= L80 OR L80 >= MINL6.81) * (ABS(MINL6.75 > L81 AND L81 < MINL6.82) * L81 + ABS(MINL6.75 <= L81 OR L81 >= MINL6.82) * (ABS(MINL6.76 > L82 AND L82 < MINL6.83) * L82 + ABS(MINL6.76 <= L82 OR L82 >= MINL6.83) * (ABS(MINL6.77 > L83 AND L83 < MINL6.84) * L83 + ABS(MINL6.77 <= L83 OR L83 >= MINL6.84) * (ABS(MINL6.78 > L84 AND L84 < MINL6.85) * L84 + ABS(MINL6.78 <= L84 OR L84 >= MINL6.85) * (ABS(MINL6.79 > L85 AND L85 < MINL6.86) * L85 + ABS(MINL6.79 <= L85 OR L85 >= MINL6.86) * (ABS(MINL6.80 > L86 AND L86 < MINL6.87) * L86 + ABS(MINL6.80 <= L86 OR L86 >= MINL6.87) * (ABS(MINL6.81 > L87 AND L87 < MINL6.88) * L87 + ABS(MINL6.81 <= L87 OR L87 >= MINL6.88) * (ABS(MINL6.82 > L88 AND L88 < MINL6.89) * L88 + ABS(MINL6.82 <= L88 OR L88 >= MINL6.89) * (ABS(MINL6.83 > L89 AND L89 < MINL6.90) * L89 + ABS(MINL6.83 <= L89 OR L89 >= MINL6.90) * (ABS(MINL6.84 > L90 AND L90 < MINL6.91) * L90 + ABS(MINL6.84 <= L90 OR L90 >= MINL6.91) * (ABS(MINL6.85 > L91 AND L91 < MINL6.92) * L91 + ABS(MINL6.85 <= L91 OR L91 >= MINL6.92) * (ABS(MINL6.86 > L92 AND L92 < MINL6.93) * L92 + ABS(MINL6.86 <= L92 OR L92 >= MINL6.93) * (ABS(MINL6.87 > L93 AND L93 < MINL6.94) * L93 + ABS(MINL6.87 <= L93 OR L93 >= MINL6.94) * (ABS(MINL6.88 > L94 AND L94 < MINL6.95) * L94 + ABS(MINL6.88 <= L94 OR L94 >= MINL6.95) * (ABS(MINL6.89 > L95 AND L95 < MINL6.96) * L95 + ABS(MINL6.89 <= L95 OR L95 >= MINL6.96) * (ABS(MINL6.90 > L96 AND L96 < MINL6.97) * L96 + ABS(MINL6.90 <= L96 OR L96 >= MINL6.97) * (ABS(MINL6.91 > L97 AND L97 < MINL6.98) * L97 + ABS(MINL6.91 <= L97 OR L97 >= MINL6.98) * (ABS(MINL6.92 > L98 AND L98 < MINL6.99) * L98 + ABS(MINL6.92 <= L98 OR L98 >= MINL6.99) * (ABS(MINL6.93 > L99 AND L99 < MINL6.100) * L99 + ABS(MINL6.93 <= L99 OR L99 >= MINL6.100) * (ABS(MINL6.94 > L100 AND L100 < MINL6.101) * L100 + ABS(MINL6.94 <= L100 OR L100 >= MINL6.101) * (ABS(MINL6.95 > L101 AND L101 < MINL6.102) * L101 + ABS(MINL6.95 <= L101 OR L101 >= MINL6.102) * (ABS(MINL6.96 > L102 AND L102 < MINL6.103) * L102 + ABS(MINL6.96 <= L102 OR L102 >= MINL6.103) * (ABS(MINL6.97 > L103 AND L103 < MINL6.104) * L103 + ABS(MINL6.97 <= L103 OR L103 >= MINL6.104) * (ABS(MINL6.98 > L104 AND L104 < MINL6.105) * L104 + ABS(MINL6.98 <= L104 OR L104 >= MINL6.105) * (ABS(MINL6.99 > L105 AND L105 < MINL6.106) * L105 + ABS(MINL6.99 <= L105 OR L105 >= MINL6.106) * MINL106)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - 1)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
geolinas
Posted : Wednesday, July 29, 2015 2:58:54 PM
Registered User
Joined: 5/28/2014
Posts: 26

Wow! I need to play with this some time, but it looks amazing!

Also, I am looking for another "swing High/Low" thing. It is possible to plot a channel with the upper level = the most recent identifiable swing high, and  the lower level = the most recent identifiable swing low????????? 

 
Bruce_L
Posted : Wednesday, July 29, 2015 3:35:29 PM


Worden Trainer

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

Eliminating the 100 * (C / ( at the beginning of each formula and the ) - 1) at the end of each formula should do just that. So the value of the most recently identified swing high should be the following.

ABS(MAXH6 < H6 AND H6 > MAXH6.7) * H6 + ABS(MAXH6 >= H6 OR H6 <= MAXH6.7) * (ABS(MAXH6.1 < H7 AND H7 > MAXH6.8) * H7 + ABS(MAXH6.1 >= H7 OR H7 <= MAXH6.8) * (ABS(MAXH6.2 < H8 AND H8 > MAXH6.9) * H8 + ABS(MAXH6.2 >= H8 OR H8 <= MAXH6.9) * (ABS(MAXH6.3 < H9 AND H9 > MAXH6.10) * H9 + ABS(MAXH6.3 >= H9 OR H9 <= MAXH6.10) * (ABS(MAXH6.4 < H10 AND H10 > MAXH6.11) * H10 + ABS(MAXH6.4 >= H10 OR H10 <= MAXH6.11) * (ABS(MAXH6.5 < H11 AND H11 > MAXH6.12) * H11 + ABS(MAXH6.5 >= H11 OR H11 <= MAXH6.12) * (ABS(MAXH6.6 < H12 AND H12 > MAXH6.13) * H12 + ABS(MAXH6.6 >= H12 OR H12 <= MAXH6.13) * (ABS(MAXH6.7 < H13 AND H13 > MAXH6.14) * H13 + ABS(MAXH6.7 >= H13 OR H13 <= MAXH6.14) * (ABS(MAXH6.8 < H14 AND H14 > MAXH6.15) * H14 + ABS(MAXH6.8 >= H14 OR H14 <= MAXH6.15) * (ABS(MAXH6.9 < H15 AND H15 > MAXH6.16) * H15 + ABS(MAXH6.9 >= H15 OR H15 <= MAXH6.16) * (ABS(MAXH6.10 < H16 AND H16 > MAXH6.17) * H16 + ABS(MAXH6.10 >= H16 OR H16 <= MAXH6.17) * (ABS(MAXH6.11 < H17 AND H17 > MAXH6.18) * H17 + ABS(MAXH6.11 >= H17 OR H17 <= MAXH6.18) * (ABS(MAXH6.12 < H18 AND H18 > MAXH6.19) * H18 + ABS(MAXH6.12 >= H18 OR H18 <= MAXH6.19) * (ABS(MAXH6.13 < H19 AND H19 > MAXH6.20) * H19 + ABS(MAXH6.13 >= H19 OR H19 <= MAXH6.20) * (ABS(MAXH6.14 < H20 AND H20 > MAXH6.21) * H20 + ABS(MAXH6.14 >= H20 OR H20 <= MAXH6.21) * (ABS(MAXH6.15 < H21 AND H21 > MAXH6.22) * H21 + ABS(MAXH6.15 >= H21 OR H21 <= MAXH6.22) * (ABS(MAXH6.16 < H22 AND H22 > MAXH6.23) * H22 + ABS(MAXH6.16 >= H22 OR H22 <= MAXH6.23) * (ABS(MAXH6.17 < H23 AND H23 > MAXH6.24) * H23 + ABS(MAXH6.17 >= H23 OR H23 <= MAXH6.24) * (ABS(MAXH6.18 < H24 AND H24 > MAXH6.25) * H24 + ABS(MAXH6.18 >= H24 OR H24 <= MAXH6.25) * (ABS(MAXH6.19 < H25 AND H25 > MAXH6.26) * H25 + ABS(MAXH6.19 >= H25 OR H25 <= MAXH6.26) * (ABS(MAXH6.20 < H26 AND H26 > MAXH6.27) * H26 + ABS(MAXH6.20 >= H26 OR H26 <= MAXH6.27) * (ABS(MAXH6.21 < H27 AND H27 > MAXH6.28) * H27 + ABS(MAXH6.21 >= H27 OR H27 <= MAXH6.28) * (ABS(MAXH6.22 < H28 AND H28 > MAXH6.29) * H28 + ABS(MAXH6.22 >= H28 OR H28 <= MAXH6.29) * (ABS(MAXH6.23 < H29 AND H29 > MAXH6.30) * H29 + ABS(MAXH6.23 >= H29 OR H29 <= MAXH6.30) * (ABS(MAXH6.24 < H30 AND H30 > MAXH6.31) * H30 + ABS(MAXH6.24 >= H30 OR H30 <= MAXH6.31) * (ABS(MAXH6.25 < H31 AND H31 > MAXH6.32) * H31 + ABS(MAXH6.25 >= H31 OR H31 <= MAXH6.32) * (ABS(MAXH6.26 < H32 AND H32 > MAXH6.33) * H32 + ABS(MAXH6.26 >= H32 OR H32 <= MAXH6.33) * (ABS(MAXH6.27 < H33 AND H33 > MAXH6.34) * H33 + ABS(MAXH6.27 >= H33 OR H33 <= MAXH6.34) * (ABS(MAXH6.28 < H34 AND H34 > MAXH6.35) * H34 + ABS(MAXH6.28 >= H34 OR H34 <= MAXH6.35) * (ABS(MAXH6.29 < H35 AND H35 > MAXH6.36) * H35 + ABS(MAXH6.29 >= H35 OR H35 <= MAXH6.36) * (ABS(MAXH6.30 < H36 AND H36 > MAXH6.37) * H36 + ABS(MAXH6.30 >= H36 OR H36 <= MAXH6.37) * (ABS(MAXH6.31 < H37 AND H37 > MAXH6.38) * H37 + ABS(MAXH6.31 >= H37 OR H37 <= MAXH6.38) * (ABS(MAXH6.32 < H38 AND H38 > MAXH6.39) * H38 + ABS(MAXH6.32 >= H38 OR H38 <= MAXH6.39) * (ABS(MAXH6.33 < H39 AND H39 > MAXH6.40) * H39 + ABS(MAXH6.33 >= H39 OR H39 <= MAXH6.40) * (ABS(MAXH6.34 < H40 AND H40 > MAXH6.41) * H40 + ABS(MAXH6.34 >= H40 OR H40 <= MAXH6.41) * (ABS(MAXH6.35 < H41 AND H41 > MAXH6.42) * H41 + ABS(MAXH6.35 >= H41 OR H41 <= MAXH6.42) * (ABS(MAXH6.36 < H42 AND H42 > MAXH6.43) * H42 + ABS(MAXH6.36 >= H42 OR H42 <= MAXH6.43) * (ABS(MAXH6.37 < H43 AND H43 > MAXH6.44) * H43 + ABS(MAXH6.37 >= H43 OR H43 <= MAXH6.44) * (ABS(MAXH6.38 < H44 AND H44 > MAXH6.45) * H44 + ABS(MAXH6.38 >= H44 OR H44 <= MAXH6.45) * (ABS(MAXH6.39 < H45 AND H45 > MAXH6.46) * H45 + ABS(MAXH6.39 >= H45 OR H45 <= MAXH6.46) * (ABS(MAXH6.40 < H46 AND H46 > MAXH6.47) * H46 + ABS(MAXH6.40 >= H46 OR H46 <= MAXH6.47) * (ABS(MAXH6.41 < H47 AND H47 > MAXH6.48) * H47 + ABS(MAXH6.41 >= H47 OR H47 <= MAXH6.48) * (ABS(MAXH6.42 < H48 AND H48 > MAXH6.49) * H48 + ABS(MAXH6.42 >= H48 OR H48 <= MAXH6.49) * (ABS(MAXH6.43 < H49 AND H49 > MAXH6.50) * H49 + ABS(MAXH6.43 >= H49 OR H49 <= MAXH6.50) * (ABS(MAXH6.44 < H50 AND H50 > MAXH6.51) * H50 + ABS(MAXH6.44 >= H50 OR H50 <= MAXH6.51) * (ABS(MAXH6.45 < H51 AND H51 > MAXH6.52) * H51 + ABS(MAXH6.45 >= H51 OR H51 <= MAXH6.52) * (ABS(MAXH6.46 < H52 AND H52 > MAXH6.53) * H52 + ABS(MAXH6.46 >= H52 OR H52 <= MAXH6.53) * (ABS(MAXH6.47 < H53 AND H53 > MAXH6.54) * H53 + ABS(MAXH6.47 >= H53 OR H53 <= MAXH6.54) * (ABS(MAXH6.48 < H54 AND H54 > MAXH6.55) * H54 + ABS(MAXH6.48 >= H54 OR H54 <= MAXH6.55) * (ABS(MAXH6.49 < H55 AND H55 > MAXH6.56) * H55 + ABS(MAXH6.49 >= H55 OR H55 <= MAXH6.56) * (ABS(MAXH6.50 < H56 AND H56 > MAXH6.57) * H56 + ABS(MAXH6.50 >= H56 OR H56 <= MAXH6.57) * (ABS(MAXH6.51 < H57 AND H57 > MAXH6.58) * H57 + ABS(MAXH6.51 >= H57 OR H57 <= MAXH6.58) * (ABS(MAXH6.52 < H58 AND H58 > MAXH6.59) * H58 + ABS(MAXH6.52 >= H58 OR H58 <= MAXH6.59) * (ABS(MAXH6.53 < H59 AND H59 > MAXH6.60) * H59 + ABS(MAXH6.53 >= H59 OR H59 <= MAXH6.60) * (ABS(MAXH6.54 < H60 AND H60 > MAXH6.61) * H60 + ABS(MAXH6.54 >= H60 OR H60 <= MAXH6.61) * (ABS(MAXH6.55 < H61 AND H61 > MAXH6.62) * H61 + ABS(MAXH6.55 >= H61 OR H61 <= MAXH6.62) * (ABS(MAXH6.56 < H62 AND H62 > MAXH6.63) * H62 + ABS(MAXH6.56 >= H62 OR H62 <= MAXH6.63) * (ABS(MAXH6.57 < H63 AND H63 > MAXH6.64) * H63 + ABS(MAXH6.57 >= H63 OR H63 <= MAXH6.64) * (ABS(MAXH6.58 < H64 AND H64 > MAXH6.65) * H64 + ABS(MAXH6.58 >= H64 OR H64 <= MAXH6.65) * (ABS(MAXH6.59 < H65 AND H65 > MAXH6.66) * H65 + ABS(MAXH6.59 >= H65 OR H65 <= MAXH6.66) * (ABS(MAXH6.60 < H66 AND H66 > MAXH6.67) * H66 + ABS(MAXH6.60 >= H66 OR H66 <= MAXH6.67) * (ABS(MAXH6.61 < H67 AND H67 > MAXH6.68) * H67 + ABS(MAXH6.61 >= H67 OR H67 <= MAXH6.68) * (ABS(MAXH6.62 < H68 AND H68 > MAXH6.69) * H68 + ABS(MAXH6.62 >= H68 OR H68 <= MAXH6.69) * (ABS(MAXH6.63 < H69 AND H69 > MAXH6.70) * H69 + ABS(MAXH6.63 >= H69 OR H69 <= MAXH6.70) * (ABS(MAXH6.64 < H70 AND H70 > MAXH6.71) * H70 + ABS(MAXH6.64 >= H70 OR H70 <= MAXH6.71) * (ABS(MAXH6.65 < H71 AND H71 > MAXH6.72) * H71 + ABS(MAXH6.65 >= H71 OR H71 <= MAXH6.72) * (ABS(MAXH6.66 < H72 AND H72 > MAXH6.73) * H72 + ABS(MAXH6.66 >= H72 OR H72 <= MAXH6.73) * (ABS(MAXH6.67 < H73 AND H73 > MAXH6.74) * H73 + ABS(MAXH6.67 >= H73 OR H73 <= MAXH6.74) * (ABS(MAXH6.68 < H74 AND H74 > MAXH6.75) * H74 + ABS(MAXH6.68 >= H74 OR H74 <= MAXH6.75) * (ABS(MAXH6.69 < H75 AND H75 > MAXH6.76) * H75 + ABS(MAXH6.69 >= H75 OR H75 <= MAXH6.76) * (ABS(MAXH6.70 < H76 AND H76 > MAXH6.77) * H76 + ABS(MAXH6.70 >= H76 OR H76 <= MAXH6.77) * (ABS(MAXH6.71 < H77 AND H77 > MAXH6.78) * H77 + ABS(MAXH6.71 >= H77 OR H77 <= MAXH6.78) * (ABS(MAXH6.72 < H78 AND H78 > MAXH6.79) * H78 + ABS(MAXH6.72 >= H78 OR H78 <= MAXH6.79) * (ABS(MAXH6.73 < H79 AND H79 > MAXH6.80) * H79 + ABS(MAXH6.73 >= H79 OR H79 <= MAXH6.80) * (ABS(MAXH6.74 < H80 AND H80 > MAXH6.81) * H80 + ABS(MAXH6.74 >= H80 OR H80 <= MAXH6.81) * (ABS(MAXH6.75 < H81 AND H81 > MAXH6.82) * H81 + ABS(MAXH6.75 >= H81 OR H81 <= MAXH6.82) * (ABS(MAXH6.76 < H82 AND H82 > MAXH6.83) * H82 + ABS(MAXH6.76 >= H82 OR H82 <= MAXH6.83) * (ABS(MAXH6.77 < H83 AND H83 > MAXH6.84) * H83 + ABS(MAXH6.77 >= H83 OR H83 <= MAXH6.84) * (ABS(MAXH6.78 < H84 AND H84 > MAXH6.85) * H84 + ABS(MAXH6.78 >= H84 OR H84 <= MAXH6.85) * (ABS(MAXH6.79 < H85 AND H85 > MAXH6.86) * H85 + ABS(MAXH6.79 >= H85 OR H85 <= MAXH6.86) * (ABS(MAXH6.80 < H86 AND H86 > MAXH6.87) * H86 + ABS(MAXH6.80 >= H86 OR H86 <= MAXH6.87) * (ABS(MAXH6.81 < H87 AND H87 > MAXH6.88) * H87 + ABS(MAXH6.81 >= H87 OR H87 <= MAXH6.88) * (ABS(MAXH6.82 < H88 AND H88 > MAXH6.89) * H88 + ABS(MAXH6.82 >= H88 OR H88 <= MAXH6.89) * (ABS(MAXH6.83 < H89 AND H89 > MAXH6.90) * H89 + ABS(MAXH6.83 >= H89 OR H89 <= MAXH6.90) * (ABS(MAXH6.84 < H90 AND H90 > MAXH6.91) * H90 + ABS(MAXH6.84 >= H90 OR H90 <= MAXH6.91) * (ABS(MAXH6.85 < H91 AND H91 > MAXH6.92) * H91 + ABS(MAXH6.85 >= H91 OR H91 <= MAXH6.92) * (ABS(MAXH6.86 < H92 AND H92 > MAXH6.93) * H92 + ABS(MAXH6.86 >= H92 OR H92 <= MAXH6.93) * (ABS(MAXH6.87 < H93 AND H93 > MAXH6.94) * H93 + ABS(MAXH6.87 >= H93 OR H93 <= MAXH6.94) * (ABS(MAXH6.88 < H94 AND H94 > MAXH6.95) * H94 + ABS(MAXH6.88 >= H94 OR H94 <= MAXH6.95) * (ABS(MAXH6.89 < H95 AND H95 > MAXH6.96) * H95 + ABS(MAXH6.89 >= H95 OR H95 <= MAXH6.96) * (ABS(MAXH6.90 < H96 AND H96 > MAXH6.97) * H96 + ABS(MAXH6.90 >= H96 OR H96 <= MAXH6.97) * (ABS(MAXH6.91 < H97 AND H97 > MAXH6.98) * H97 + ABS(MAXH6.91 >= H97 OR H97 <= MAXH6.98) * (ABS(MAXH6.92 < H98 AND H98 > MAXH6.99) * H98 + ABS(MAXH6.92 >= H98 OR H98 <= MAXH6.99) * (ABS(MAXH6.93 < H99 AND H99 > MAXH6.100) * H99 + ABS(MAXH6.93 >= H99 OR H99 <= MAXH6.100) * (ABS(MAXH6.94 < H100 AND H100 > MAXH6.101) * H100 + ABS(MAXH6.94 >= H100 OR H100 <= MAXH6.101) * (ABS(MAXH6.95 < H101 AND H101 > MAXH6.102) * H101 + ABS(MAXH6.95 >= H101 OR H101 <= MAXH6.102) * (ABS(MAXH6.96 < H102 AND H102 > MAXH6.103) * H102 + ABS(MAXH6.96 >= H102 OR H102 <= MAXH6.103) * (ABS(MAXH6.97 < H103 AND H103 > MAXH6.104) * H103 + ABS(MAXH6.97 >= H103 OR H103 <= MAXH6.104) * (ABS(MAXH6.98 < H104 AND H104 > MAXH6.105) * H104 + ABS(MAXH6.98 >= H104 OR H104 <= MAXH6.105) * (ABS(MAXH6.99 < H105 AND H105 > MAXH6.106) * H105 + ABS(MAXH6.99 >= H105 OR H105 <= MAXH6.106) * MAXH106)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

And the value of the most recently identified swing low should be the following.

ABS(MINL6 > L6 AND L6 < MINL6.7) * L6 + ABS(MINL6 <= L6 OR L6 >= MINL6.7) * (ABS(MINL6.1 > L7 AND L7 < MINL6.8) * L7 + ABS(MINL6.1 <= L7 OR L7 >= MINL6.8) * (ABS(MINL6.2 > L8 AND L8 < MINL6.9) * L8 + ABS(MINL6.2 <= L8 OR L8 >= MINL6.9) * (ABS(MINL6.3 > L9 AND L9 < MINL6.10) * L9 + ABS(MINL6.3 <= L9 OR L9 >= MINL6.10) * (ABS(MINL6.4 > L10 AND L10 < MINL6.11) * L10 + ABS(MINL6.4 <= L10 OR L10 >= MINL6.11) * (ABS(MINL6.5 > L11 AND L11 < MINL6.12) * L11 + ABS(MINL6.5 <= L11 OR L11 >= MINL6.12) * (ABS(MINL6.6 > L12 AND L12 < MINL6.13) * L12 + ABS(MINL6.6 <= L12 OR L12 >= MINL6.13) * (ABS(MINL6.7 > L13 AND L13 < MINL6.14) * L13 + ABS(MINL6.7 <= L13 OR L13 >= MINL6.14) * (ABS(MINL6.8 > L14 AND L14 < MINL6.15) * L14 + ABS(MINL6.8 <= L14 OR L14 >= MINL6.15) * (ABS(MINL6.9 > L15 AND L15 < MINL6.16) * L15 + ABS(MINL6.9 <= L15 OR L15 >= MINL6.16) * (ABS(MINL6.10 > L16 AND L16 < MINL6.17) * L16 + ABS(MINL6.10 <= L16 OR L16 >= MINL6.17) * (ABS(MINL6.11 > L17 AND L17 < MINL6.18) * L17 + ABS(MINL6.11 <= L17 OR L17 >= MINL6.18) * (ABS(MINL6.12 > L18 AND L18 < MINL6.19) * L18 + ABS(MINL6.12 <= L18 OR L18 >= MINL6.19) * (ABS(MINL6.13 > L19 AND L19 < MINL6.20) * L19 + ABS(MINL6.13 <= L19 OR L19 >= MINL6.20) * (ABS(MINL6.14 > L20 AND L20 < MINL6.21) * L20 + ABS(MINL6.14 <= L20 OR L20 >= MINL6.21) * (ABS(MINL6.15 > L21 AND L21 < MINL6.22) * L21 + ABS(MINL6.15 <= L21 OR L21 >= MINL6.22) * (ABS(MINL6.16 > L22 AND L22 < MINL6.23) * L22 + ABS(MINL6.16 <= L22 OR L22 >= MINL6.23) * (ABS(MINL6.17 > L23 AND L23 < MINL6.24) * L23 + ABS(MINL6.17 <= L23 OR L23 >= MINL6.24) * (ABS(MINL6.18 > L24 AND L24 < MINL6.25) * L24 + ABS(MINL6.18 <= L24 OR L24 >= MINL6.25) * (ABS(MINL6.19 > L25 AND L25 < MINL6.26) * L25 + ABS(MINL6.19 <= L25 OR L25 >= MINL6.26) * (ABS(MINL6.20 > L26 AND L26 < MINL6.27) * L26 + ABS(MINL6.20 <= L26 OR L26 >= MINL6.27) * (ABS(MINL6.21 > L27 AND L27 < MINL6.28) * L27 + ABS(MINL6.21 <= L27 OR L27 >= MINL6.28) * (ABS(MINL6.22 > L28 AND L28 < MINL6.29) * L28 + ABS(MINL6.22 <= L28 OR L28 >= MINL6.29) * (ABS(MINL6.23 > L29 AND L29 < MINL6.30) * L29 + ABS(MINL6.23 <= L29 OR L29 >= MINL6.30) * (ABS(MINL6.24 > L30 AND L30 < MINL6.31) * L30 + ABS(MINL6.24 <= L30 OR L30 >= MINL6.31) * (ABS(MINL6.25 > L31 AND L31 < MINL6.32) * L31 + ABS(MINL6.25 <= L31 OR L31 >= MINL6.32) * (ABS(MINL6.26 > L32 AND L32 < MINL6.33) * L32 + ABS(MINL6.26 <= L32 OR L32 >= MINL6.33) * (ABS(MINL6.27 > L33 AND L33 < MINL6.34) * L33 + ABS(MINL6.27 <= L33 OR L33 >= MINL6.34) * (ABS(MINL6.28 > L34 AND L34 < MINL6.35) * L34 + ABS(MINL6.28 <= L34 OR L34 >= MINL6.35) * (ABS(MINL6.29 > L35 AND L35 < MINL6.36) * L35 + ABS(MINL6.29 <= L35 OR L35 >= MINL6.36) * (ABS(MINL6.30 > L36 AND L36 < MINL6.37) * L36 + ABS(MINL6.30 <= L36 OR L36 >= MINL6.37) * (ABS(MINL6.31 > L37 AND L37 < MINL6.38) * L37 + ABS(MINL6.31 <= L37 OR L37 >= MINL6.38) * (ABS(MINL6.32 > L38 AND L38 < MINL6.39) * L38 + ABS(MINL6.32 <= L38 OR L38 >= MINL6.39) * (ABS(MINL6.33 > L39 AND L39 < MINL6.40) * L39 + ABS(MINL6.33 <= L39 OR L39 >= MINL6.40) * (ABS(MINL6.34 > L40 AND L40 < MINL6.41) * L40 + ABS(MINL6.34 <= L40 OR L40 >= MINL6.41) * (ABS(MINL6.35 > L41 AND L41 < MINL6.42) * L41 + ABS(MINL6.35 <= L41 OR L41 >= MINL6.42) * (ABS(MINL6.36 > L42 AND L42 < MINL6.43) * L42 + ABS(MINL6.36 <= L42 OR L42 >= MINL6.43) * (ABS(MINL6.37 > L43 AND L43 < MINL6.44) * L43 + ABS(MINL6.37 <= L43 OR L43 >= MINL6.44) * (ABS(MINL6.38 > L44 AND L44 < MINL6.45) * L44 + ABS(MINL6.38 <= L44 OR L44 >= MINL6.45) * (ABS(MINL6.39 > L45 AND L45 < MINL6.46) * L45 + ABS(MINL6.39 <= L45 OR L45 >= MINL6.46) * (ABS(MINL6.40 > L46 AND L46 < MINL6.47) * L46 + ABS(MINL6.40 <= L46 OR L46 >= MINL6.47) * (ABS(MINL6.41 > L47 AND L47 < MINL6.48) * L47 + ABS(MINL6.41 <= L47 OR L47 >= MINL6.48) * (ABS(MINL6.42 > L48 AND L48 < MINL6.49) * L48 + ABS(MINL6.42 <= L48 OR L48 >= MINL6.49) * (ABS(MINL6.43 > L49 AND L49 < MINL6.50) * L49 + ABS(MINL6.43 <= L49 OR L49 >= MINL6.50) * (ABS(MINL6.44 > L50 AND L50 < MINL6.51) * L50 + ABS(MINL6.44 <= L50 OR L50 >= MINL6.51) * (ABS(MINL6.45 > L51 AND L51 < MINL6.52) * L51 + ABS(MINL6.45 <= L51 OR L51 >= MINL6.52) * (ABS(MINL6.46 > L52 AND L52 < MINL6.53) * L52 + ABS(MINL6.46 <= L52 OR L52 >= MINL6.53) * (ABS(MINL6.47 > L53 AND L53 < MINL6.54) * L53 + ABS(MINL6.47 <= L53 OR L53 >= MINL6.54) * (ABS(MINL6.48 > L54 AND L54 < MINL6.55) * L54 + ABS(MINL6.48 <= L54 OR L54 >= MINL6.55) * (ABS(MINL6.49 > L55 AND L55 < MINL6.56) * L55 + ABS(MINL6.49 <= L55 OR L55 >= MINL6.56) * (ABS(MINL6.50 > L56 AND L56 < MINL6.57) * L56 + ABS(MINL6.50 <= L56 OR L56 >= MINL6.57) * (ABS(MINL6.51 > L57 AND L57 < MINL6.58) * L57 + ABS(MINL6.51 <= L57 OR L57 >= MINL6.58) * (ABS(MINL6.52 > L58 AND L58 < MINL6.59) * L58 + ABS(MINL6.52 <= L58 OR L58 >= MINL6.59) * (ABS(MINL6.53 > L59 AND L59 < MINL6.60) * L59 + ABS(MINL6.53 <= L59 OR L59 >= MINL6.60) * (ABS(MINL6.54 > L60 AND L60 < MINL6.61) * L60 + ABS(MINL6.54 <= L60 OR L60 >= MINL6.61) * (ABS(MINL6.55 > L61 AND L61 < MINL6.62) * L61 + ABS(MINL6.55 <= L61 OR L61 >= MINL6.62) * (ABS(MINL6.56 > L62 AND L62 < MINL6.63) * L62 + ABS(MINL6.56 <= L62 OR L62 >= MINL6.63) * (ABS(MINL6.57 > L63 AND L63 < MINL6.64) * L63 + ABS(MINL6.57 <= L63 OR L63 >= MINL6.64) * (ABS(MINL6.58 > L64 AND L64 < MINL6.65) * L64 + ABS(MINL6.58 <= L64 OR L64 >= MINL6.65) * (ABS(MINL6.59 > L65 AND L65 < MINL6.66) * L65 + ABS(MINL6.59 <= L65 OR L65 >= MINL6.66) * (ABS(MINL6.60 > L66 AND L66 < MINL6.67) * L66 + ABS(MINL6.60 <= L66 OR L66 >= MINL6.67) * (ABS(MINL6.61 > L67 AND L67 < MINL6.68) * L67 + ABS(MINL6.61 <= L67 OR L67 >= MINL6.68) * (ABS(MINL6.62 > L68 AND L68 < MINL6.69) * L68 + ABS(MINL6.62 <= L68 OR L68 >= MINL6.69) * (ABS(MINL6.63 > L69 AND L69 < MINL6.70) * L69 + ABS(MINL6.63 <= L69 OR L69 >= MINL6.70) * (ABS(MINL6.64 > L70 AND L70 < MINL6.71) * L70 + ABS(MINL6.64 <= L70 OR L70 >= MINL6.71) * (ABS(MINL6.65 > L71 AND L71 < MINL6.72) * L71 + ABS(MINL6.65 <= L71 OR L71 >= MINL6.72) * (ABS(MINL6.66 > L72 AND L72 < MINL6.73) * L72 + ABS(MINL6.66 <= L72 OR L72 >= MINL6.73) * (ABS(MINL6.67 > L73 AND L73 < MINL6.74) * L73 + ABS(MINL6.67 <= L73 OR L73 >= MINL6.74) * (ABS(MINL6.68 > L74 AND L74 < MINL6.75) * L74 + ABS(MINL6.68 <= L74 OR L74 >= MINL6.75) * (ABS(MINL6.69 > L75 AND L75 < MINL6.76) * L75 + ABS(MINL6.69 <= L75 OR L75 >= MINL6.76) * (ABS(MINL6.70 > L76 AND L76 < MINL6.77) * L76 + ABS(MINL6.70 <= L76 OR L76 >= MINL6.77) * (ABS(MINL6.71 > L77 AND L77 < MINL6.78) * L77 + ABS(MINL6.71 <= L77 OR L77 >= MINL6.78) * (ABS(MINL6.72 > L78 AND L78 < MINL6.79) * L78 + ABS(MINL6.72 <= L78 OR L78 >= MINL6.79) * (ABS(MINL6.73 > L79 AND L79 < MINL6.80) * L79 + ABS(MINL6.73 <= L79 OR L79 >= MINL6.80) * (ABS(MINL6.74 > L80 AND L80 < MINL6.81) * L80 + ABS(MINL6.74 <= L80 OR L80 >= MINL6.81) * (ABS(MINL6.75 > L81 AND L81 < MINL6.82) * L81 + ABS(MINL6.75 <= L81 OR L81 >= MINL6.82) * (ABS(MINL6.76 > L82 AND L82 < MINL6.83) * L82 + ABS(MINL6.76 <= L82 OR L82 >= MINL6.83) * (ABS(MINL6.77 > L83 AND L83 < MINL6.84) * L83 + ABS(MINL6.77 <= L83 OR L83 >= MINL6.84) * (ABS(MINL6.78 > L84 AND L84 < MINL6.85) * L84 + ABS(MINL6.78 <= L84 OR L84 >= MINL6.85) * (ABS(MINL6.79 > L85 AND L85 < MINL6.86) * L85 + ABS(MINL6.79 <= L85 OR L85 >= MINL6.86) * (ABS(MINL6.80 > L86 AND L86 < MINL6.87) * L86 + ABS(MINL6.80 <= L86 OR L86 >= MINL6.87) * (ABS(MINL6.81 > L87 AND L87 < MINL6.88) * L87 + ABS(MINL6.81 <= L87 OR L87 >= MINL6.88) * (ABS(MINL6.82 > L88 AND L88 < MINL6.89) * L88 + ABS(MINL6.82 <= L88 OR L88 >= MINL6.89) * (ABS(MINL6.83 > L89 AND L89 < MINL6.90) * L89 + ABS(MINL6.83 <= L89 OR L89 >= MINL6.90) * (ABS(MINL6.84 > L90 AND L90 < MINL6.91) * L90 + ABS(MINL6.84 <= L90 OR L90 >= MINL6.91) * (ABS(MINL6.85 > L91 AND L91 < MINL6.92) * L91 + ABS(MINL6.85 <= L91 OR L91 >= MINL6.92) * (ABS(MINL6.86 > L92 AND L92 < MINL6.93) * L92 + ABS(MINL6.86 <= L92 OR L92 >= MINL6.93) * (ABS(MINL6.87 > L93 AND L93 < MINL6.94) * L93 + ABS(MINL6.87 <= L93 OR L93 >= MINL6.94) * (ABS(MINL6.88 > L94 AND L94 < MINL6.95) * L94 + ABS(MINL6.88 <= L94 OR L94 >= MINL6.95) * (ABS(MINL6.89 > L95 AND L95 < MINL6.96) * L95 + ABS(MINL6.89 <= L95 OR L95 >= MINL6.96) * (ABS(MINL6.90 > L96 AND L96 < MINL6.97) * L96 + ABS(MINL6.90 <= L96 OR L96 >= MINL6.97) * (ABS(MINL6.91 > L97 AND L97 < MINL6.98) * L97 + ABS(MINL6.91 <= L97 OR L97 >= MINL6.98) * (ABS(MINL6.92 > L98 AND L98 < MINL6.99) * L98 + ABS(MINL6.92 <= L98 OR L98 >= MINL6.99) * (ABS(MINL6.93 > L99 AND L99 < MINL6.100) * L99 + ABS(MINL6.93 <= L99 OR L99 >= MINL6.100) * (ABS(MINL6.94 > L100 AND L100 < MINL6.101) * L100 + ABS(MINL6.94 <= L100 OR L100 >= MINL6.101) * (ABS(MINL6.95 > L101 AND L101 < MINL6.102) * L101 + ABS(MINL6.95 <= L101 OR L101 >= MINL6.102) * (ABS(MINL6.96 > L102 AND L102 < MINL6.103) * L102 + ABS(MINL6.96 <= L102 OR L102 >= MINL6.103) * (ABS(MINL6.97 > L103 AND L103 < MINL6.104) * L103 + ABS(MINL6.97 <= L103 OR L103 >= MINL6.104) * (ABS(MINL6.98 > L104 AND L104 < MINL6.105) * L104 + ABS(MINL6.98 <= L104 OR L104 >= MINL6.105) * (ABS(MINL6.99 > L105 AND L105 < MINL6.106) * L105 + ABS(MINL6.99 <= L105 OR L105 >= MINL6.106) * MINL106)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
geolinas
Posted : Wednesday, July 29, 2015 3:43:57 PM
Registered User
Joined: 5/28/2014
Posts: 26

Thank you very much!!!!!!  ;) 

 

stochastics
Posted : Saturday, October 10, 2015 3:01:11 PM
Registered User
Joined: 3/3/2013
Posts: 57
Morning Bruce,
Subject: A watchlist column - Numeric value when boolean condition is met:
 
I want to add to my watchlist a price column based on when this boolean condition is met:
XAVGC5 > XAVG(XAVGC5,2) 
 
Is there a PCF that will identify price - only when it first becomes true (& another column when it first becomes false)?  
And that will update as a watchlist column when the condition becomes true (or false) again?  
 
Bruce_L
Posted : Monday, October 12, 2015 12:26:24 PM


Worden Trainer

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

The following Indicator Formula uses the techniques given in the Days Since Last Peak (or other day-counting needs) topic to look back at the most recent 40 bars for C when your Condition Formula most recently become true. It will return 0 if this did not happen in the most recent 40 bars.

ABS(XAVGC2 > XAVGC5 AND XAVGC2.1 <= XAVGC5.1) * C + ABS(XAVGC2 <= XAVGC5 OR XAVGC2.1 > XAVGC5.1) * (ABS(XAVGC2.1 > XAVGC5.1 AND XAVGC2.2 <= XAVGC5.2) * C1 + ABS(XAVGC2.1 <= XAVGC5.1 OR XAVGC2.2 > XAVGC5.2) * (ABS(XAVGC2.2 > XAVGC5.2 AND XAVGC2.3 <= XAVGC5.3) * C2 + ABS(XAVGC2.2 <= XAVGC5.2 OR XAVGC2.3 > XAVGC5.3) * (ABS(XAVGC2.3 > XAVGC5.3 AND XAVGC2.4 <= XAVGC5.4) * C3 + ABS(XAVGC2.3 <= XAVGC5.3 OR XAVGC2.4 > XAVGC5.4) * (ABS(XAVGC2.4 > XAVGC5.4 AND XAVGC2.5 <= XAVGC5.5) * C4 + ABS(XAVGC2.4 <= XAVGC5.4 OR XAVGC2.5 > XAVGC5.5) * (ABS(XAVGC2.5 > XAVGC5.5 AND XAVGC2.6 <= XAVGC5.6) * C5 + ABS(XAVGC2.5 <= XAVGC5.5 OR XAVGC2.6 > XAVGC5.6) * (ABS(XAVGC2.6 > XAVGC5.6 AND XAVGC2.7 <= XAVGC5.7) * C6 + ABS(XAVGC2.6 <= XAVGC5.6 OR XAVGC2.7 > XAVGC5.7) * (ABS(XAVGC2.7 > XAVGC5.7 AND XAVGC2.8 <= XAVGC5.8) * C7 + ABS(XAVGC2.7 <= XAVGC5.7 OR XAVGC2.8 > XAVGC5.8) * (ABS(XAVGC2.8 > XAVGC5.8 AND XAVGC2.9 <= XAVGC5.9) * C8 + ABS(XAVGC2.8 <= XAVGC5.8 OR XAVGC2.9 > XAVGC5.9) * (ABS(XAVGC2.9 > XAVGC5.9 AND XAVGC2.10 <= XAVGC5.10) * C9 + ABS(XAVGC2.9 <= XAVGC5.9 OR XAVGC2.10 > XAVGC5.10) * (ABS(XAVGC2.10 > XAVGC5.10 AND XAVGC2.11 <= XAVGC5.11) * C10 + ABS(XAVGC2.10 <= XAVGC5.10 OR XAVGC2.11 > XAVGC5.11) * (ABS(XAVGC2.11 > XAVGC5.11 AND XAVGC2.12 <= XAVGC5.12) * C11 + ABS(XAVGC2.11 <= XAVGC5.11 OR XAVGC2.12 > XAVGC5.12) * (ABS(XAVGC2.12 > XAVGC5.12 AND XAVGC2.13 <= XAVGC5.13) * C12 + ABS(XAVGC2.12 <= XAVGC5.12 OR XAVGC2.13 > XAVGC5.13) * (ABS(XAVGC2.13 > XAVGC5.13 AND XAVGC2.14 <= XAVGC5.14) * C13 + ABS(XAVGC2.13 <= XAVGC5.13 OR XAVGC2.14 > XAVGC5.14) * (ABS(XAVGC2.14 > XAVGC5.14 AND XAVGC2.15 <= XAVGC5.15) * C14 + ABS(XAVGC2.14 <= XAVGC5.14 OR XAVGC2.15 > XAVGC5.15) * (ABS(XAVGC2.15 > XAVGC5.15 AND XAVGC2.16 <= XAVGC5.16) * C15 + ABS(XAVGC2.15 <= XAVGC5.15 OR XAVGC2.16 > XAVGC5.16) * (ABS(XAVGC2.16 > XAVGC5.16 AND XAVGC2.17 <= XAVGC5.17) * C16 + ABS(XAVGC2.16 <= XAVGC5.16 OR XAVGC2.17 > XAVGC5.17) * (ABS(XAVGC2.17 > XAVGC5.17 AND XAVGC2.18 <= XAVGC5.18) * C17 + ABS(XAVGC2.17 <= XAVGC5.17 OR XAVGC2.18 > XAVGC5.18) * (ABS(XAVGC2.18 > XAVGC5.18 AND XAVGC2.19 <= XAVGC5.19) * C18 + ABS(XAVGC2.18 <= XAVGC5.18 OR XAVGC2.19 > XAVGC5.19) * (ABS(XAVGC2.19 > XAVGC5.19 AND XAVGC2.20 <= XAVGC5.20) * C19 + ABS(XAVGC2.19 <= XAVGC5.19 OR XAVGC2.20 > XAVGC5.20) * (ABS(XAVGC2.20 > XAVGC5.20 AND XAVGC2.21 <= XAVGC5.21) * C20 + ABS(XAVGC2.20 <= XAVGC5.20 OR XAVGC2.21 > XAVGC5.21) * (ABS(XAVGC2.21 > XAVGC5.21 AND XAVGC2.22 <= XAVGC5.22) * C21 + ABS(XAVGC2.21 <= XAVGC5.21 OR XAVGC2.22 > XAVGC5.22) * (ABS(XAVGC2.22 > XAVGC5.22 AND XAVGC2.23 <= XAVGC5.23) * C22 + ABS(XAVGC2.22 <= XAVGC5.22 OR XAVGC2.23 > XAVGC5.23) * (ABS(XAVGC2.23 > XAVGC5.23 AND XAVGC2.24 <= XAVGC5.24) * C23 + ABS(XAVGC2.23 <= XAVGC5.23 OR XAVGC2.24 > XAVGC5.24) * (ABS(XAVGC2.24 > XAVGC5.24 AND XAVGC2.25 <= XAVGC5.25) * C24 + ABS(XAVGC2.24 <= XAVGC5.24 OR XAVGC2.25 > XAVGC5.25) * (ABS(XAVGC2.25 > XAVGC5.25 AND XAVGC2.26 <= XAVGC5.26) * C25 + ABS(XAVGC2.25 <= XAVGC5.25 OR XAVGC2.26 > XAVGC5.26) * (ABS(XAVGC2.26 > XAVGC5.26 AND XAVGC2.27 <= XAVGC5.27) * C26 + ABS(XAVGC2.26 <= XAVGC5.26 OR XAVGC2.27 > XAVGC5.27) * (ABS(XAVGC2.27 > XAVGC5.27 AND XAVGC2.28 <= XAVGC5.28) * C27 + ABS(XAVGC2.27 <= XAVGC5.27 OR XAVGC2.28 > XAVGC5.28) * (ABS(XAVGC2.28 > XAVGC5.28 AND XAVGC2.29 <= XAVGC5.29) * C28 + ABS(XAVGC2.28 <= XAVGC5.28 OR XAVGC2.29 > XAVGC5.29) * (ABS(XAVGC2.29 > XAVGC5.29 AND XAVGC2.30 <= XAVGC5.30) * C29 + ABS(XAVGC2.29 <= XAVGC5.29 OR XAVGC2.30 > XAVGC5.30) * (ABS(XAVGC2.30 > XAVGC5.30 AND XAVGC2.31 <= XAVGC5.31) * C30 + ABS(XAVGC2.30 <= XAVGC5.30 OR XAVGC2.31 > XAVGC5.31) * (ABS(XAVGC2.31 > XAVGC5.31 AND XAVGC2.32 <= XAVGC5.32) * C31 + ABS(XAVGC2.31 <= XAVGC5.31 OR XAVGC2.32 > XAVGC5.32) * (ABS(XAVGC2.32 > XAVGC5.32 AND XAVGC2.33 <= XAVGC5.33) * C32 + ABS(XAVGC2.32 <= XAVGC5.32 OR XAVGC2.33 > XAVGC5.33) * (ABS(XAVGC2.33 > XAVGC5.33 AND XAVGC2.34 <= XAVGC5.34) * C33 + ABS(XAVGC2.33 <= XAVGC5.33 OR XAVGC2.34 > XAVGC5.34) * (ABS(XAVGC2.34 > XAVGC5.34 AND XAVGC2.35 <= XAVGC5.35) * C34 + ABS(XAVGC2.34 <= XAVGC5.34 OR XAVGC2.35 > XAVGC5.35) * (ABS(XAVGC2.35 > XAVGC5.35 AND XAVGC2.36 <= XAVGC5.36) * C35 + ABS(XAVGC2.35 <= XAVGC5.35 OR XAVGC2.36 > XAVGC5.36) * (ABS(XAVGC2.36 > XAVGC5.36 AND XAVGC2.37 <= XAVGC5.37) * C36 + ABS(XAVGC2.36 <= XAVGC5.36 OR XAVGC2.37 > XAVGC5.37) * (ABS(XAVGC2.37 > XAVGC5.37 AND XAVGC2.38 <= XAVGC5.38) * C37 + ABS(XAVGC2.37 <= XAVGC5.37 OR XAVGC2.38 > XAVGC5.38) * (ABS(XAVGC2.38 > XAVGC5.38 AND XAVGC2.39 <= XAVGC5.39) * C38 + ABS(XAVGC2.38 <= XAVGC5.38 OR XAVGC2.39 > XAVGC5.39) * (ABS(XAVGC2.39 > XAVGC5.39 AND XAVGC2.40 <= XAVGC5.40) * C39)))))))))))))))))))))))))))))))))))))))

The following Indicator Formula is the same except that it returns the value of C the last time your formula became false in the most recent 40 bars.

ABS(XAVGC2 <= XAVGC5 OR XAVGC2.1 > XAVGC5.1) * C + ABS(XAVGC2 > XAVGC5 AND XAVGC2.1 <= XAVGC5.1) * (ABS(XAVGC2.1 <= XAVGC5.1 OR XAVGC2.2 > XAVGC5.2) * C1 + ABS(XAVGC2.1 > XAVGC5.1 AND XAVGC2.2 <= XAVGC5.2) * (ABS(XAVGC2.2 <= XAVGC5.2 OR XAVGC2.3 > XAVGC5.3) * C2 + ABS(XAVGC2.2 > XAVGC5.2 AND XAVGC2.3 <= XAVGC5.3) * (ABS(XAVGC2.3 <= XAVGC5.3 OR XAVGC2.4 > XAVGC5.4) * C3 + ABS(XAVGC2.3 > XAVGC5.3 AND XAVGC2.4 <= XAVGC5.4) * (ABS(XAVGC2.4 <= XAVGC5.4 OR XAVGC2.5 > XAVGC5.5) * C4 + ABS(XAVGC2.4 > XAVGC5.4 AND XAVGC2.5 <= XAVGC5.5) * (ABS(XAVGC2.5 <= XAVGC5.5 OR XAVGC2.6 > XAVGC5.6) * C5 + ABS(XAVGC2.5 > XAVGC5.5 AND XAVGC2.6 <= XAVGC5.6) * (ABS(XAVGC2.6 <= XAVGC5.6 OR XAVGC2.7 > XAVGC5.7) * C6 + ABS(XAVGC2.6 > XAVGC5.6 AND XAVGC2.7 <= XAVGC5.7) * (ABS(XAVGC2.7 <= XAVGC5.7 OR XAVGC2.8 > XAVGC5.8) * C7 + ABS(XAVGC2.7 > XAVGC5.7 AND XAVGC2.8 <= XAVGC5.8) * (ABS(XAVGC2.8 <= XAVGC5.8 OR XAVGC2.9 > XAVGC5.9) * C8 + ABS(XAVGC2.8 > XAVGC5.8 AND XAVGC2.9 <= XAVGC5.9) * (ABS(XAVGC2.9 <= XAVGC5.9 OR XAVGC2.10 > XAVGC5.10) * C9 + ABS(XAVGC2.9 > XAVGC5.9 AND XAVGC2.10 <= XAVGC5.10) * (ABS(XAVGC2.10 <= XAVGC5.10 OR XAVGC2.11 > XAVGC5.11) * C10 + ABS(XAVGC2.10 > XAVGC5.10 AND XAVGC2.11 <= XAVGC5.11) * (ABS(XAVGC2.11 <= XAVGC5.11 OR XAVGC2.12 > XAVGC5.12) * C11 + ABS(XAVGC2.11 > XAVGC5.11 AND XAVGC2.12 <= XAVGC5.12) * (ABS(XAVGC2.12 <= XAVGC5.12 OR XAVGC2.13 > XAVGC5.13) * C12 + ABS(XAVGC2.12 > XAVGC5.12 AND XAVGC2.13 <= XAVGC5.13) * (ABS(XAVGC2.13 <= XAVGC5.13 OR XAVGC2.14 > XAVGC5.14) * C13 + ABS(XAVGC2.13 > XAVGC5.13 AND XAVGC2.14 <= XAVGC5.14) * (ABS(XAVGC2.14 <= XAVGC5.14 OR XAVGC2.15 > XAVGC5.15) * C14 + ABS(XAVGC2.14 > XAVGC5.14 AND XAVGC2.15 <= XAVGC5.15) * (ABS(XAVGC2.15 <= XAVGC5.15 OR XAVGC2.16 > XAVGC5.16) * C15 + ABS(XAVGC2.15 > XAVGC5.15 AND XAVGC2.16 <= XAVGC5.16) * (ABS(XAVGC2.16 <= XAVGC5.16 OR XAVGC2.17 > XAVGC5.17) * C16 + ABS(XAVGC2.16 > XAVGC5.16 AND XAVGC2.17 <= XAVGC5.17) * (ABS(XAVGC2.17 <= XAVGC5.17 OR XAVGC2.18 > XAVGC5.18) * C17 + ABS(XAVGC2.17 > XAVGC5.17 AND XAVGC2.18 <= XAVGC5.18) * (ABS(XAVGC2.18 <= XAVGC5.18 OR XAVGC2.19 > XAVGC5.19) * C18 + ABS(XAVGC2.18 > XAVGC5.18 AND XAVGC2.19 <= XAVGC5.19) * (ABS(XAVGC2.19 <= XAVGC5.19 OR XAVGC2.20 > XAVGC5.20) * C19 + ABS(XAVGC2.19 > XAVGC5.19 AND XAVGC2.20 <= XAVGC5.20) * (ABS(XAVGC2.20 <= XAVGC5.20 OR XAVGC2.21 > XAVGC5.21) * C20 + ABS(XAVGC2.20 > XAVGC5.20 AND XAVGC2.21 <= XAVGC5.21) * (ABS(XAVGC2.21 <= XAVGC5.21 OR XAVGC2.22 > XAVGC5.22) * C21 + ABS(XAVGC2.21 > XAVGC5.21 AND XAVGC2.22 <= XAVGC5.22) * (ABS(XAVGC2.22 <= XAVGC5.22 OR XAVGC2.23 > XAVGC5.23) * C22 + ABS(XAVGC2.22 > XAVGC5.22 AND XAVGC2.23 <= XAVGC5.23) * (ABS(XAVGC2.23 <= XAVGC5.23 OR XAVGC2.24 > XAVGC5.24) * C23 + ABS(XAVGC2.23 > XAVGC5.23 AND XAVGC2.24 <= XAVGC5.24) * (ABS(XAVGC2.24 <= XAVGC5.24 OR XAVGC2.25 > XAVGC5.25) * C24 + ABS(XAVGC2.24 > XAVGC5.24 AND XAVGC2.25 <= XAVGC5.25) * (ABS(XAVGC2.25 <= XAVGC5.25 OR XAVGC2.26 > XAVGC5.26) * C25 + ABS(XAVGC2.25 > XAVGC5.25 AND XAVGC2.26 <= XAVGC5.26) * (ABS(XAVGC2.26 <= XAVGC5.26 OR XAVGC2.27 > XAVGC5.27) * C26 + ABS(XAVGC2.26 > XAVGC5.26 AND XAVGC2.27 <= XAVGC5.27) * (ABS(XAVGC2.27 <= XAVGC5.27 OR XAVGC2.28 > XAVGC5.28) * C27 + ABS(XAVGC2.27 > XAVGC5.27 AND XAVGC2.28 <= XAVGC5.28) * (ABS(XAVGC2.28 <= XAVGC5.28 OR XAVGC2.29 > XAVGC5.29) * C28 + ABS(XAVGC2.28 > XAVGC5.28 AND XAVGC2.29 <= XAVGC5.29) * (ABS(XAVGC2.29 <= XAVGC5.29 OR XAVGC2.30 > XAVGC5.30) * C29 + ABS(XAVGC2.29 > XAVGC5.29 AND XAVGC2.30 <= XAVGC5.30) * (ABS(XAVGC2.30 <= XAVGC5.30 OR XAVGC2.31 > XAVGC5.31) * C30 + ABS(XAVGC2.30 > XAVGC5.30 AND XAVGC2.31 <= XAVGC5.31) * (ABS(XAVGC2.31 <= XAVGC5.31 OR XAVGC2.32 > XAVGC5.32) * C31 + ABS(XAVGC2.31 > XAVGC5.31 AND XAVGC2.32 <= XAVGC5.32) * (ABS(XAVGC2.32 <= XAVGC5.32 OR XAVGC2.33 > XAVGC5.33) * C32 + ABS(XAVGC2.32 > XAVGC5.32 AND XAVGC2.33 <= XAVGC5.33) * (ABS(XAVGC2.33 <= XAVGC5.33 OR XAVGC2.34 > XAVGC5.34) * C33 + ABS(XAVGC2.33 > XAVGC5.33 AND XAVGC2.34 <= XAVGC5.34) * (ABS(XAVGC2.34 <= XAVGC5.34 OR XAVGC2.35 > XAVGC5.35) * C34 + ABS(XAVGC2.34 > XAVGC5.34 AND XAVGC2.35 <= XAVGC5.35) * (ABS(XAVGC2.35 <= XAVGC5.35 OR XAVGC2.36 > XAVGC5.36) * C35 + ABS(XAVGC2.35 > XAVGC5.35 AND XAVGC2.36 <= XAVGC5.36) * (ABS(XAVGC2.36 <= XAVGC5.36 OR XAVGC2.37 > XAVGC5.37) * C36 + ABS(XAVGC2.36 > XAVGC5.36 AND XAVGC2.37 <= XAVGC5.37) * (ABS(XAVGC2.37 <= XAVGC5.37 OR XAVGC2.38 > XAVGC5.38) * C37 + ABS(XAVGC2.37 > XAVGC5.37 AND XAVGC2.38 <= XAVGC5.38) * (ABS(XAVGC2.38 <= XAVGC5.38 OR XAVGC2.39 > XAVGC5.39) * C38 + ABS(XAVGC2.38 > XAVGC5.38 AND XAVGC2.39 <= XAVGC5.39) * (ABS(XAVGC2.39 <= XAVGC5.39 OR XAVGC2.40 > XAVGC5.40) * C39)))))))))))))))))))))))))))))))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
gabe.aboitiz
Posted : Tuesday, February 23, 2016 3:35:03 PM
Registered User
Joined: 11/19/2015
Posts: 7

HI bruce,

just wanted to ask about using swing high/lows to identify the underlying trend. Ive found that no matter the moving average period i use, whether 50 or 200 i havent been able to tune it so that it recognizes the overlying trend. like if the stock has an overlying uptrend but has recently been dropping quite drastically then it recognizes this as a downtrend. I just need a formula that will identify the overarching main trend.

 

thanks

Putt4Dough
Posted : Tuesday, February 23, 2016 5:11:59 PM

Registered User
Joined: 7/30/2007
Posts: 1,072

Hi Gabe, that's the $64,000,000 question :) 

I think the first thing Bruce will tell you is that it depends on your "specific unambiguous objective" definition of "the oeverarching main trend".

Personally, I'd start with plain old Dow Theory (higher highs, higher lows, etc ...) but TC2000 can't be programmed for that since there's no looping in the PCF language.

But it can be done visually on a chart with draing tools. I personally recognize an uptrend starting when you get a higher high, a higher low, and price then "takes out" the higher high. The reverse being true for downtrends. Then there are the transitions from uptrend to downtrend to uptrend that I won't get into here.

Others will use different definitions and different formulas. I think it's the difference between buying a suit off-the-rack and getting a tailored suit. Your definition of a trend should match your trading goals: short-term? long-term? how much risk are you comfortable accepting? And so on.

Good luck!

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.