Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Thank you fyour suggestion.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
How would you write the following formula for a PCF:
- The 2 bar slope of the TSV-24 using a Hull Average is positive?
- Also, how would I write the same formula for a histogram indicator?
Thanks for your help. Kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am not quite sure if a "2 bar slope" is the slope between the two most recent bars.
HAVG(TSV, 24) > HAVG(TSV1.1, 24)
Or between two bars ago and the current bar.
HAVG(TSV, 24) > HAVG(TSV1.2, 24)
I am assuming the histogram would involve substracting a moving average of some sort of the Hull TSV24 from the Hull TSV24, but without more details I cannot say for sure what the best format of the formula might be.
Let's say it is a 9 period hull moving average. If so, checking for a positive slope between the two most recent bars would be the following.
HAVG(TSV, 24) - HAVG(HAVG(TSV, 24), 9) > HAVG(TSV1.1, 24) - HAVG(HAVG(TSV1.1, 24), 9)
And between two bars and the current bar would be the following.
HAVG(TSV, 24) - HAVG(HAVG(TSV, 24), 9) > HAVG(TSV1.2, 24) - HAVG(HAVG(TSV1.2, 24), 9)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
Sorry, I need to clarify:
- the 2 bar slope should be the slope between the most recent bars
- the MA I'm using with the TSV-24_Hull is a FW-12, fron-weighted 12 period.
Thanks,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following condition formula for the histogram.
HAVG(TSV, 24) - FAVG(HAVG(TSV, 24), 12) > HAVG(TSV1.1, 24) - FAVG(HAVG(TSV1.1, 24), 12)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
When I enter the last formula into an indicator PCF, it wants to save it as a Condition.
I would, however, like to plot the TSV24-Hull on a chart, as a histogram, i.e.green if positive (don't require a negative histo bar).
Thanks,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The formula for the histogram itself would be the following.
HAVG(TSV, 24) - FAVG(HAVG(TSV, 24), 12)
If you really only want this to plot when the histogram is green, you could use the following instead.
IIF(HAVG(TSV, 24) > FAVG(HAVG(TSV, 24), 12), HAVG(TSV, 24) - FAVG(HAVG(TSV, 24), 12), 0)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks very much - I appreciate your help.
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hello Bruce,
I just plotted the histogram and noticed two things:
1. The histogram bar is positive only after the TSV24-Hull has crossed above the Fw12 MA;
2. The scale is not 0 to +1 for the positive histogram bars.
Any way you could modify the formula so that only the 2 bar slope of the TSV-24-Hull counts for a positive histogram bar, and not the FW12 MA at all?
Is it possible to rescale this, so that a positive TSV24-Hull slope is always +1 ?
((6 * (FAVG(HAVG(TSV, 24), 2) - AVG(HAVG(TSV, 24), 2)) / 1) > 0) possibly with this???
Thanks, sorry to bring this up again.
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I would seriously never guess from the language used in your previous inquiries that this would be what you want. It is not at all how these words and phrases would normally be interpreted.
Please try the following condition formula.
IIF(HAVG(TSV, 24) > HAVG(TSV1.1, 24), 1, 0)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks Bruce - it works fine.
Sorry about the terminology, at least my last message seemed clear to me. But that may have something to do with the fact that my mother tongue is German, and that I spend the last 30 years living in Cenral Europe. But my English isn't too shabby, at least that's what I'm told.
Kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I suspect it has more to do with the specialized terminology of the technical analysis of equities.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hello Bruce,
Here are two indicators which I use to plot a histogram (from 0 to 1/On or Off) on the chart.
They are oriented around the 24-period TSV using a Hull MA and work fine with their
present parameters.
I would like to change these to use the Moving Linear Regression 7-period instead of the
7-period Hull MA:
- 2-Bar Slope of the TSV-24
IIF(HAVG(TSV, 24) > HAVG(TSV1.1, 24), 1, 0)
- TSV-24 is above the Hull MA-7 Signal Line
IIF(HAVG(TSV, 24) > FAVG(HAVG(TSV, 24), 7), 1, 0)
- I also use the opposite, when TSV-24 is below the Signal Line.
Thanks for your help.
Kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am not sure what periods and averages you want changed in the formulas. Neither of these has a 7-period Hull MA.
The first has a 2-bar slope and a 24 period Hull moving average (to construct a 24 period Hull TSV).
The second has a 24 period Hull moving average (to connstruct a 24-period Hull TSV) and a 7 period front weighted moving average.
On another note, is there a particular reason you need the histogram to be 0 to 1 instead of 0 to 100?
If 0 to 100 works instead of 0 to 1, the formulas could be shorter by just using a Custom PCF % True Indicator with the base Boolean formula instead of a Custom PCF Indicator with the added IIF(Boolean formula here, 1, 0) structure around it.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
I guess the first formula is okay. And maintaining the Hull-TSV is good also.
I would then only need the 7-period front-weighted MA in the second formula changed
to a 7-period moving linear regression. This would improve the vicinity of the signal line to the Hull-TSV,
probably moreso than using a FWMA-7.
I just saw the o to +1 scale on the indicator itself. the scaling is customized, bounded by top and bottom,
with manual top and manual bottom, set at 1.05 and 0.50 respectively.
Thanks and regards, Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following condition formula.
IIF(HAVG(TSV, 24) > 3 * FAVG(HAVG(TSV, 24), 7) - 2 * AVG(HAVG(TSV, 24), 7), 1, 0)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks very much, Bruce.
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
This is probably an easy one.
I have a formula which specifies that the T3-4-1.618 MA is below the current bar's low.
How could I ammend this to check for the T3 being below the current and below the previous
low bars?
(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4)) < L
Thanks,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It depends on if you want the T3 at each bar to below the low of the same bar.
TrueInRow((-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4)) < L, 2) = 2
Or the T3 of the current bar to be below the low of the two most recent bars.
(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4)) < MINL2
Note that I assume your code as written works in writing the above and didn't test either your formulas or the resulting formulas. I just copied and pasted your code.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks very much - I needed the second formula. Kind regards, Chris
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
I have two separate filter conditions which work well on their own:
1) IIF(V > 1.618 * AVGV6.1, V, 1 / 0)
[I plot this one as a histogram on the charts]
2) V < AVGV50
[I don't plot this specifically, just overlay an SMA50 over the volume]
Basically, I would like to have a PCF Condition formula which includes these
two conditions, but only requires (either) one of them to be present. (OR)
Thanks and kind regards,
Chris
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Forgot to ask a totally different question:
3) Some stocks (like WEB) have no volatility and move in a straight line because they have been bought, etc.
What condition could I use to ensure that the stock is active, i.e. perhaps if it has a bar range of more than 2% within the last 20 bars?
Thanks, Bruce.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The raw condition formula would be the following.
V > 1.618 * AVGV6.1 OR V < AVGV50
If you want to plot volume only when this is true:
IIF(V > 1.618 * AVGV6.1 OR V < AVGV50, V, 1 / 0)
If you want to check for a specific range you can, but you can generally check for activity by checking for something like at least some range in the most recent 5 bars or so on a daily chart.
MAXH5 > MINL5
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks very much Bruce - I appreciate your help.
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
Some time ago you coded a PCF condition formula for finding the three smallest consecutive bar ranges within the last 30 days (or 20 business days), as follows:
MAXH3 - MINL3 < MAXH3.1 - MINL3.1 AND MAXH3 - MINL3 < MAXH3.2 - MINL3.2 AND MAXH3 - MINL3 < MAXH3.3 - MINL3.3 AND MAXH3 - MINL3 < MAXH3.4 - MINL3.4 AND MAXH3 - MINL3 < MAXH3.5 - MINL3.5 AND MAXH3 - MINL3 < MAXH3.6 - MINL3.6 AND MAXH3 - MINL3 < MAXH3.7 - MINL3.7 AND MAXH3 - MINL3 < MAXH3.8 - MINL3.8 AND MAXH3 - MINL3 < MAXH3.9 - MINL3.9 AND MAXH3 - MINL3 < MAXH3.10 - MINL3.10 AND MAXH3 - MINL3 < MAXH3.11 - MINL3.11 AND MAXH3 - MINL3 < MAXH3.12 - MINL3.12 AND MAXH3 - MINL3 < MAXH3.13 - MINL3.13 AND MAXH3 - MINL3 < MAXH3.14 - MINL3.14 AND MAXH3 - MINL3 < MAXH3.15 - MINL3.15 AND MAXH3 - MINL3 < MAXH3.16 - MINL3.16 AND MAXH3 - MINL3 < MAXH3.17 - MINL3.17 AND MAXH3 - MINL3 < MAXH3.18 - MINL3.18 AND MAXH3 - MINL3 < MAXH3.19 - MINL3.19 AND MAXH3 - MINL3 < MAXH3.20 - MINL3.20
I would like to adapt this formula to look for the four smallest consecutive range bars for the same period as above.
Many thanks and kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It looks like it was quite a while ago. The formula in your post could be re-written as follows for TC2000 v18.
MAXH3 - MINL3 < MIN(MAXH3.1 - MINL3.1, 20)
Which would allow us to write the 4 bar version as follows.
MAXH4 - MINL4 < MIN(MAXH4.1 - MINL4.1, 20)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks much Bruce - it was a long time ago. Thanks for simplifying these PCFs.
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
Right now I'm using two separate filters for my version of a (BB/KB) Squeeze:
1. The exponential BBTOP (20, 2) is below the exponential Keltner (16, 1.30) Top channel
2. The exponential BBBOT (20, 2) is above the exponential Keltner (16, 1.30) Bottom channel
I did these two by means of the "Create Condition" function on the chart.
I wondered whether you would code a PCF Condition formula for me which includes both setups
I outlined above?
Many thanks and kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following for 1:
XAVGC20 + 2 * STDDEV20 < XAVG((H + L + C) / 3 + 1.3 * ATR, 16)
And the following for 2:
XAVGC20 - 2 * STDDEV20 > XAVG((H + L + C) / 3 - 1.3 * ATR, 16)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks Bruce,
Any way I can tie these two together into one PCF? Using AND?
Kind regards,
Chris
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Yes, just put parens around both formulas and put AND in the middle.
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks a lot Bruce, appreciate your help.
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Bruce,
I've been looking at thos two formulas and can see that the Keltner Upper and Lower channels are specified by the +/- xxx ATRs.
What I don't see offhand is a differentiation of the BBTOP and BBBOT.
In condition #1 need the BBTOP to be below the KB Top, and in #2 the BBBOT to be above the KBBottom.
Is there a way to write the PCF using BBTOP(2,20), BBBOT(2,20), KCTOP(1.3,16) and KCBOTTOM(1.3,16)?
Thanks for your insight. Kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you use BBTOP(2, 20) and BBBOT(2, 20) you will get simple Bollinger Bands instead of exponential Bollinger Bands.
Note there is a + in the first formula before the < sign and a - in the second formula before the > sign. This is what changes it between being upper and lower bands.
KCTOP(1.3, 16) and KCBOTTOM(1.3, 16) is not valid syntax and you can't just make up your own and have it work, so no, you can't write it the way you want. You need to write out both formulas using the longer forms given in my most recent post.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks Bruce, I understand now, had overlooked the +- on the Bollinger formula.
Have another formula you might help me with:
I would like to stipulate in one PCF formula:
- Exponential Bollinger Bands (0.55, 21) are sourced from the spread BBBOT(0.2, 20) - XAVGC13
- There is an XAVGC13 below the center line and above the lower band of the exponential BB(0.55, 21)
- This XAVGC13 is lower today than it was 3 bars ago
Many thanks for your help, Bruce.
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following condition formula.
XAVG(BBBOT(.2, 20) - XAVGC13, 21) - .55 * SQR(ABS(SUM((BBBOT(.2, 20) - XAVGC13) ^ 2, 21) - 21 * AVG(BBBOT(.2, 20) - XAVGC13, 21) ^ 2) / 21) < XAVG(BBBOT(.2, 20) - XAVGC13, 13) AND XAVG(BBBOT(.2, 20) - XAVGC13, 13) < XAVG(BBBOT(.2, 20) - XAVGC13, 21) AND XAVG(BBBOT(.2, 20) - XAVGC13, 13) < XAVG(BBBOT(.2, 20, 3) - XAVGC13.3, 13)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Thanks much Bruce,
I may have noticed something in your formula:
The Spread (BBBOT - EMA13 uses 0.2, 20 for the BB). However the Spread is the source of a 'second' BB which uses the different parameters 0.55 and 21.
It is within the bottom to the center line of this second BB that we are looking to find the EMA13, and if present, it should be lower today than 3 bars ago.
I'm seeing pretty consistent 0.2 bandwidth parameters?
Thanks,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
That Bollinger Band need to be manually expanded both because it is exponential and because it is of something other than price. Do you see the - .55 * and six instances of 21 in the formula? Those are the width settings and periods of that Bollinger Band (five of the 21 s are used in the lower BB calculations and one in the center BB calculation).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 6/14/2016 Posts: 285
|
Sorry, I see you've taken that into account. Thanks for all your help. Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |