Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Finding Bollinger Band and Moving Average Crossovers Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
JCPINVESTxxxxxxxxxxxxxxxxxxxxxxxx
Posted : Sunday, May 13, 2007 7:24:05 AM
Registered User
Joined: 8/6/2005
Posts: 37
Hi ... I'm using a 10 8 Bollinger Band and a 20 Simple Moving Average. For Bullish moves, I want to find the first day that the stock price rises above BOTH the 20 SMA and the UPPER band of the BB. For Bearish moves, I want to find the first day that the stock prices drops below BOTH the SMA 20 and the LOWER band of the BB. Thanks, Jay
Bruce_L
Posted : Monday, May 14, 2007 10:26:47 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following:

Bullish Moves:

C > AVGC20 AND C > AVGC10 + .8 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 - 10 * AVGC10 ^ 2) / 9) AND NOT(C1 > AVGC20.1 AND C1 > AVGC10.1 + .8 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 - 10 * AVGC10.1 ^ 2) / 9))

Bearish Moves:

C < AVGC20 AND C < AVGC10 - .8 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 - 10 * AVGC10 ^ 2) / 9) AND NOT(C1 < AVGC20.1 AND C1 < AVGC10.1 - .8 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 - 10 * AVGC10.1 ^ 2) / 9))

You may wish to review the following:

Handy PCF example formulas to help you learn the syntax of PCFs!
Modelling Bollinger Bands (& Standard Deviation) in a TC PCF
How to create a Personal Criteria Forumula (PCF)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
JCPINVESTxxxxxxxxxxxxxxxxxxxxxxxx
Posted : Saturday, May 19, 2007 10:12:12 AM
Registered User
Joined: 8/6/2005
Posts: 37
Hi Bruce ... After using your PCF, I realized that I needed to clarify that I'm not looking for a crossover of BOTH the 10 8 BB and the 20 SMA. On bullish moves, I'm looking for a stock when it first breaks above the upper band of the 10 8 BB when the stock is ALREADY ABOVE the 20 SMA. Conversely, on bearish moves, I'm looking for a stock when it first breaks below the lower band of the 10 8 BB when the stock is ALREADY BELOW to 20 SMA. Thanks again, Jay
Winnie
Posted : Saturday, May 19, 2007 2:08:59 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Below are the PCFs for Bollinger Bands (10,8). The SGN PCFs will require setting the Range Selector to +2 or -2.

For PCF No 5 – The Range Selector Values set as follows (similar for Lower BB):
+2 : Price Crossing X Up through Upper BB
0 : Price did not cross BB
-2 : Price Crossing X Down through Upper BB

For PCF No 1 and 3 - Price Above BB add and start PCF with C > or Below BB C <

For PCF No7 – Range Selector Values 1 and above, Price Above SMA20, Values less than 1 Price is Below SMA20.

Hope this helps
Winnie



Bollinger Bands (10,8)

No 1 : Upper BB (10,8)
AVGC10 + .8 * SQR (ABS (C^2 + C1^2 + C2^2 + C3^2 + C4^2 + C5^2 +C6^2 + C7^2 + C8^2 + C9^2 - 10 * AVGC10^2) / 9)

No 2 : Middle BB (10,8) is the SMA10AVGC10

No 3 : Lower BB (10,8)
AVGC10 - .8 * SQR (ABS (C^2 + C1^2 + C2^2 + C3^2 + C4^2 + C5^2 +C6^2 + C7^2 + C8^2 + C9^2 - 10 * AVGC10^2) / 9)

No 4 : Price X Upper BB (10,8) (Boolean)
C > AVGC10 + .8 * SQR(ABS(C^2 + C1^2 + C2^2 + C3^2 + C4^2 + C5^2 + C6^2 + C7^2 + C8^2 + C9^2 - 10 * AVGC10^2) / 9) AND C1 < AVGC10.1 + .8 * SQR(ABS(C1^2 + C2^2 + C3^2 + C4^2 + C5^2 + C6^2 + C7^2 + C8^2 + C9^2 + C10^2 - 10 * AVGC10.1^2) / 9)

No 5 : Price X Upper BB (10,8) (SGN)
SGN(C - (AVGC10 + .8 * SQR (ABS (C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 - 10 * AVGC10 ^ 2) / 9))) - SGN(C1 - (AVGC10.1 + .8 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 - 10 * AVGC10.1 ^ 2) / 9)))

No 6 : Price X Lower BB (10,8) (SGN)
SGN(C - (AVGC10 - .8 * SQR (ABS (C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 - 10 * AVGC10 ^ 2) / 9))) - SGN(C1 - (AVGC10.1 - .8 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 - 10 * AVGC10.1 ^ 2) / 9)))

No 7 : Price Above or Below SMA20
C / AVGC20

JCPINVESTxxxxxxxxxxxxxxxxxxxxxxxx
Posted : Sunday, May 20, 2007 10:08:07 AM
Registered User
Joined: 8/6/2005
Posts: 37
Thanks Winnie. I appreciate your help! What are the Range Selector Values, where do I find them and how do I set them? Also, what does SGN stand for? Jay
Winnie
Posted : Sunday, May 20, 2007 1:43:55 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Jay,

The SGN is a math function, Wikipedia definition and some other TC2007 math function examples are given below.

From Wikipedia : In mathematics and especially in computer science, the sign function is a logical function which extracts the sign of a real number. To avoid confusion with the sine function, this function is often called the signum function (after the Latin form of "sign"). The sign function is often represented as sgn and can be defined thus:



Some Math Function Operators : EasyScan Language Equivalent
Multiply : *
Divide : /
Add : +
Subtract : -
Absolute Value : ABS
Average : AVG
Natural Log : LOG
Exponent : EXP
Square Root : SQR
Sign Function : SGN

The Range Selector is available for each math PCF, go to the EasyScan Editing Conditions.
First include a SGN function PCF in a EasyScan
Select the (SGN) PCF and left click.
Condition Type (Select) : Value (there is also List Rank and Market Rank)
Scroll the Value (Blue Color Range Selector) Bottom UP arrow till it hits the Value +2

Hope this helps
Winnie
Bruce_L
Posted : Monday, May 21, 2007 9:40:16 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (JCPINVEST)
After using your PCF, I realized that I needed to clarify that I'm not looking for a crossover of BOTH the 10 8 BB and the 20 SMA. On bullish moves, I'm looking for a stock when it first breaks above the upper band of the 10 8 BB when the stock is ALREADY ABOVE the 20 SMA. Conversely, on bearish moves, I'm looking for a stock when it first breaks below the lower band of the 10 8 BB when the stock is ALREADY BELOW to 20 SMA.

You may wish to try the following instead:

Bullish Moves:

C > AVGC20 AND C > AVGC10 + .8 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 - 10 * AVGC10 ^ 2) / 9) AND C1 <= AVGC10.1 + .8 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 - 10 * AVGC10.1 ^ 2) / 9)

Bearish Moves:

C < AVGC20 AND C < AVGC10 - .8 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 - 10 * AVGC10 ^ 2) / 9) AND C1 >= AVGC10.1 - .8 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 - 10 * AVGC10.1 ^ 2) / 9)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
JCPINVESTxxxxxxxxxxxxxxxxxxxxxxxx
Posted : Tuesday, May 22, 2007 7:31:29 AM
Registered User
Joined: 8/6/2005
Posts: 37
Hi Bruce - That works fine. Now, I'd like to sort my list by the best or the worst performing industries. For my bullish scan, I'd like to further sort the list by the top performing industries over the past several days (I'd like to be able to put in any time span I chose such as 2 days, 5 days, 10 days, etc.)For my bearish scan, I'd like to further sort the list by the worst performing industries over the past several days (I'd like to be able to put in any time span I chose such as 2 days, 5 days, 10 days, etc.) Just point out where in the PCF I would enter the specified number of dsys. Thanks for your help! Jay
Bruce_L
Posted : Tuesday, May 22, 2007 8:37:18 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
JCPINVEST,
There are many ways to define performance. The simplest is probably Price Percent Change. The easiest way to sort by this in a modifiable way is to use Custom Date Sorts:

Sorting Stocks by their Absolute or Relative Performance

Personal Criteria Formulas for this are not complicated however:

2-Period Price Percent Change:

100 * C / C2 - 100

5-Period Price Percent Change:

100 * C / C5 - 100

10-Period Price Percent Change:

100 * C / C10 - 100

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
JCPINVESTxxxxxxxxxxxxxxxxxxxxxxxx
Posted : Monday, September 24, 2007 9:21:50 PM
Registered User
Joined: 8/6/2005
Posts: 37
Hi Bruce - I'm not getting the results I expected. It seems that whenever I run the scan from your May 21st posting, I get the same 325 stocks. They seem to not even have met any of the criteria we requested. Can you check this out and maybe identify what I'm doing incorrectly? The name of my EZ Scan which uses your PCF is:
"MOBO - Bullish w 20 SMA"

Thanks, Jay
Bruce_L
Posted : Tuesday, September 25, 2007 8:43:57 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
JCPINVEST,
If the results never change, the Personal Criteria Formulas are not getting updated or are not actually part of your EasyScan. This could be a result of settings or a corruption of either the PCF or EasyScan.

Start by making sure you are updating your PCFs. Then make sure that "Do not update this criteria" is unchecked for the PCFs involved (and do another update if it was checked).

If that does resolve the issue, verify that the specific PCFs involved are actually EasyScan Conditions in the specific EasyScan where the results do not change.

If this does not work (or was not the issue), please try re-creating any PCFs and EasyScans involved from scratch. If this does not resolve the issue, please contact technical support (bringing this topic to their attention).

All e-mail communication sent to support@worden.com during business hours (Monday through Friday 9AM-11PM and Saturday and Sunday 9AM-3PM ET) should be answered within 20 minutes of arrival. For an even quicker response to tech support questions, we recommend calling our voice line at (919) 408-0542 (there is no phone support on Sundays, some Market Holidays or after 9PM ET on weekdays).

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