StockFetcher Forums · Filter Exchange · Howard Pasternack's Improved "Bollinger Method IV" Scan<< >>Post Follow-up
johncoxme
12 posts
msg #123464
Ignore johncoxme
4/4/2015 10:36:23 AM

Came across this user-contributed scan at StockCharts.com and wonder how to code it in SF:

This scan implements Bollinger's Method IV (Confirmed Breakout), but adds additional checks for trend and volume.

In short, Method IV requires:

Day 1: Close inside the band and bandwidth within 25% of lowest bandwidth in 6 months

Day 2: Close outside the band

Day 3: Signal if close is higher than Day 2

[type = stock]
and [SMA(20,volume) > 100000]
and [close > yesterday's close]
and [SMA(200,close) > 20 days ago SMA(200,close)]
and [SMA(200,close) > 60 days ago SMA(200,close)]
and [min(10,SMA(50,close)) > max(10,SMA(200,close))]
and [MACD Hist(12,26,9) >= yesterday's MACD Hist(12,26,9)]
and [2 days ago %B(20,2) < 1]
and [2 days ago %B(20,2) > -1]
and [yesterday's %B(20,2) > 1]
and [min(3,BB Width(20,2)) < 1.25 * min(120,BB Width(20,2))]
and [PVO Line(12,26,9) > yesterday's PVO Line(12,26,9)]
and [SMA(3,volume) > 1.5 * SMA(120,volume)]
and [Slow Stoch %K(70,3) > 50]
and [Weekly MACD Hist(12,26,9) >= 2 weeks ago MACD Hist(12,26,9)]

jimvin
173 posts
msg #123594
Ignore jimvin
modified
4/17/2015 8:50:52 PM

Asking me to write a stock filter is a bit like asking Ringo Starr to write a song...the results are entertaining at best, embarrassing at worst, but certainly nothing that one would call an immortal masterpiece.

That said, given my limited but sincere talents and StockFetcher's power and few limitations, here is an approximation of what you requested.

Stock is optionable
and SMA(20) volume > 100000
and close > yesterday's close
and ma(200) > ma(200) 20 days ago
and close > ma(200)
and ma(200) > ma(200) 60 days ago
and MA(200) close > SMA(200) close 60 days ago
and 10 day SMA(50) close > 10 day SMA(200) close
and MACD Hist(12,26,9) >= yesterday's MACD Hist(12,26,9)]
and BOLLINGER %B(20,2) 2 DAYS AGO BELOW 1.0
and BOLLINGER %B(20,2) 2 DAYS AGO ABOVE 1.0
and BOLLINGER %B(20,2) 1 DAYS AGO > 1
and PVO(12,26,9) crossed above PVO(12,26,9) 1 DAYS AGO
and MA(7) > 1.5*MA(120)
and Slow Stoch %K(70,3) > 50
and Weekly MACD Hist(12,26,9) >= 2 weeks ago MACD Hist(12,26,9)

Whilst I cannot speak for the absolute accuracy of the results, the syntax survived the StockFetcher editor check.

Far greater (or more skilled) minds than mine will need to verify the detailed correspondences to the original.



Kevin_in_GA
4,599 posts
msg #123595
Ignore Kevin_in_GA
4/17/2015 10:46:41 PM

Not exactly what the fans want to hear, Ringo, but a valiant effort.

Let's break it down line by line so that there are teachable moments here:

Stock is optionable
This is correct.

and SMA(20) volume > 100000
average volume(20) above 100000

and close > yesterday's close
close above close 1 day ago

and ma(200) > ma(200) 20 days ago
this is correct, but for consistency I would use "ma(200) above ma(200) 1 day ago"

and close > ma(200)
this is correct, but for consistency I would use "close above ma(200)"

and ma(200) > ma(200) 60 days ago
and MA(200) close > SMA(200) close 60 days ago
these mean the same thing - use "ma(200) above ma(200) 60 days ago"

and 10 day SMA(50) close > 10 day SMA(200) close
cma(ma(50),10) above cma(ma(200),10) - here you need to use the custom moving average() function

and MACD Hist(12,26,9) >= yesterday's MACD Hist(12,26,9)]
MACD Histogram(12,26,9) above MACD HIstogram(12,26,9) 1 day ago"

and BOLLINGER %B(20,2) 2 DAYS AGO BELOW 1.0
and BOLLINGER %B(20,2) 2 DAYS AGO ABOVE 1.0
these are contradictory - the code is fine but you need to choose which one is what you want

and BOLLINGER %B(20,2) 1 DAY AGO ABOVE 1
I cleaned it up a touch but the code is fine

and PVO(12,26,9) crossed above PVO(12,26,9) 1 DAYS AGO
this is the same as "PVO(12,26,9) above PVO(12,26,9) 1 day ago" - if that is what you mean use this syntax instead

and MA(7) > 1.5*MA(120)
ma(7) above 1.5 * ma(120)

and Slow Stoch %K(70,3) > 50
this is fine, but again for consistency (and avoiding possible weirdness since the symbol is used in HTML code) I would use "above" rather than ">"

and Weekly MACD Hist(12,26,9) >= 2 weeks ago MACD Hist(12,26,9)
Weekly MACD Histogram(12,26,9) above weekly MACD Histogram(12,26,9) 2 weeks ago

compound_gains
222 posts
msg #123596
Ignore compound_gains
modified
4/18/2015 7:17:18 AM

Nice contribution, again, Kevin. There's a wealth of basic syntax info in that lesson that any newbie should benefit from. Kudos to the others for taking a crack at the syntax.

I think line 10 should be a negative 1 (-1) based on johncoxme's code??

Fetcher[Stock is optionable
average volume(20) above 100000
close above close 1 day ago
ma(200) above ma(200) 1 day ago
close above ma(200)
ma(200) above ma(200) 60 days ago
cma(ma(50),10) above cma(ma(200),10)
MACD Histogram(12,26,9) above MACD HIstogram(12,26,9) 1 day ago
BOLLINGER %B(20,2) 2 DAYS AGO BELOW 1.0
BOLLINGER %B(20,2) 2 DAYS AGO ABOVE -1.0
BOLLINGER %B(20,2) 1 DAY AGO ABOVE 1
PVO(12,26,9) above PVO(12,26,9) 1 day ago
ma(7) above 1.5 * ma(120)
Slow Stoch %K(70,3) above 50
Weekly MACD Histogram(12,26,9) above weekly MACD Histogram(12,26,9) 2 weeks ago
]



=================================================

and MACD Hist(12,26,9) >= yesterday's MACD Hist(12,26,9)]
MACD Histogram(12,26,9) above MACD HIstogram(12,26,9) 1 day ago

You could also use...

count(MACD Histogram(12,26,9) below MACD HIstogram(12,26,9) 1 day ago, 1) equals 0

...which would give the >= result

mahkoh
1,065 posts
msg #123599
Ignore mahkoh
modified
4/18/2015 2:40:06 PM

and MA(7) > 1.5*MA(120)
ma(7) above 1.5 * ma(120)

SF will interpret this as : ma(7) above 1.5
One must first use a set statement to define 1.5 * ma(120):

set{x,1.5 * ma(120)}
ma(7) above x

My go at coding the original request:

Fetcher[
average volume(20) above 100000
close above close 1 day ago
ma(200) above ma(200) 20 days ago
ma(200) above ma(200) 60 days ago
ma(50) 10 day low above ma(200) 10 day high
macd histogram(12,26,9) above macd histogram (12,26,9) 1 day ago
bollinger %b(20,2) 2 days ago below 1
bollinger %b(20,2) 2 days ago above -1
bollinger %b(20,2) 1 day ago above 1
set{x,Bollinger Width(20,2) 120 day low * 1.25}
Bollinger Width(20,2) 3 day low below x
pvo(12,26,9) above pvo(12,26,9) 1 day ago
set{y,average volume(120) * 1.5}
average volume(3) above y
Slow Stoch %K(70,3) above 50
count(macd histogram(12,26,9) below macd histogram(12,26,9) 2 weeks ago,1) below 0.5
]



jimvin
173 posts
msg #123607
Ignore jimvin
4/19/2015 9:33:08 PM

Having written a dozen management texts, I am accustomed to finding myself at the mercy of editors; my thanks to all those who carried the torch further...

johncoxme
12 posts
msg #123647
Ignore johncoxme
4/25/2015 2:49:47 AM

blessings to you all..you brought to life a Monster scan...just what i was wishing for
john

fotchstecker
304 posts
msg #123657
Ignore fotchstecker
4/28/2015 9:41:23 AM

Kevin, thanks again here.

StockFetcher Forums · Filter Exchange · Howard Pasternack's Improved "Bollinger Method IV" Scan<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.