StockFetcher Forums · General Discussion · What is the best way to write this filter<< 1 2 >>Post Follow-up
86 posts
msg #150931
Ignore kossvet
2/26/2020 8:33:38 PM

I would like to write a filter showing MA divergence.
Where the space between MA(5) and ma(10) is increasing
and the space between ma(10) and ma(20) is increasing.
A perfect example of what I'm trying to describe can be found by observing the chart of SAVA.
Between the months of Nov 2019 and Dec 2019.
The moving averages are starting to separate exactly how I would like.
Nothing huge, or distorted.
Just smooth inclination of all moving averages.
I use MA(5), Ma(10), Ma(20), Ma(50), Ma(100), Ma(200)
I stumbled on to this stock in October, not following any filter.
Then it exploded upward. I've been trying ever since to duplicate this performance.
I also stumbled on to CLSD, and GNPX. Both of these stocks were played without the aid of a filter.
Both stocks completely exploded upward.
What I have gleaned from these stocks graphs, are long consolidation periods, within a tight range.
then the moving averages start to separate, this is the time to make a commitment.
Any help would be greatly appreciated.

86 posts
msg #150932
Ignore kossvet
2/26/2020 8:43:00 PM

Also codx, which absolutely exploded today, had the same symmetry in it's graph.
Long tight consolidation period, followed by a smooth separation between the moving averages.

641 posts
msg #150933
Ignore Cheese
2/26/2020 8:54:04 PM


I remember that graftonian had a Guppy filter that also pursued something similar.
Maybe Mactheriverrat had something, too.
You may want to search graf's good works:

In the meantime, I wrote this code for you.
Maybe better coders will come along.


DRAW Ma(10)
DRAW Ma(20)
DRAW Ma(50)
DRAW Ma(100)
DRAW Ma(200)

/* MACD uaes eMAs */
draw MACD(5,10,9)
draw MACD(10,20,9)

/* PPO uses MAs but expresses in % */
draw PPO(5,10,9) line at 0
draw PPO(10,20,9) line at 0

/* doing manually */
draw ma5ma10diff line at 0
draw ma10ma20diff line at 0

641 posts
msg #150934
Ignore Cheese
2/26/2020 9:10:13 PM

graftonian's works on WIDTHs and discussion with Mactheriverrat can be found here:

641 posts
msg #150936
Ignore Cheese
2/26/2020 9:17:42 PM

How your four stocks would look with graftonian's WIDTHs fillter
SYMLIST(SAVA,CLSD,GNPX,CODX) /* Robert kossvet, to find new picks, comment out your four picks */

/* */

/*Guppy MMA */
market is not OTCBB
Average Volume(30) > 1000000
close between .50 and 10

/*short term emas*/
draw EMA(3)
draw EMA(5)
draw EMA(7)
draw EMA(9)
draw EMA(11)
draw EMA(13)
/*add a point for every pair stacked right */
set{SS35, count(EMA(3) > EMA(5),1)}
set{SS57, count(EMA(5) > EMA(7), 1)}
set{SS79, count(EMA(7) > EMA(9), 1)}
set{SS911, count(EMA(9) > EMA(11), 1)}
set{SS1113, count(EMA(11) > EMA(13), 1)}

set{ss1, SS35 + SS57}'
set{ss2, ss1 + SS79}
set{ss3, ss2 + SS911}
set{short_term_score, ss3 + SS1113}

/*long term emas*/
draw EMA(70)
draw EMA(60)
draw EMA(50)
draw EMA(40)
draw EMA(35)
draw EMA(30)

set{LS6070, count(EMA(60) > EMA(70), 1)}
set{LS5060, count(EMA(50) > EMA(60), 1)}
set{LS4050, count(EMA(40) > EMA(50), 1)}
set{LS3540, count(EMA(35) > EMA(40), 1)}
set{LS3035, count(EMA(30) > EMA(35), 1)}
set{LS1, LS6070 + LS5060}
set{LS2, LS1 + LS4050}
set{LS3, LS2 + LS3540}
set{long_term_score, LS3 + LS3035}

draw long_term_score
draw short_term_score
set{comp_score, long_term_score + short_term_score}

add column separator
add column short_term_score
add column long_term_score
add column comp_score
add column separator

/*trader/investor separation */
set{tisep, ema(13) - ema(30)}
set{tisep2, tisep / ema(30)}
set{tiseppct, tisep2 * 100}
add column tiseppct{TR_INV_SEP}

/* trader group width */
set{tgw, ema(3) - ema(13)}
set{tgw2, tgw / ema(13)}
set{trad_grp_width, tgw2 * 100}
add column trad_grp_width

/* investor group width */
set{igw, ema(30) - ema(70)}
set{igw2, igw / ema(70)}
set{inv_grp_width, igw2 * 100}
add column inv_grp_width
draw inv_grp_width
draw trad_grp_width on plot inv_grp_width
draw inv_grp_width line at 0

/* investor annualized slope percent */
set{iasp, slope of ema(50)}
set{iasp2, iasp / ema(50)}
set{iasp3, iasp2 * 25000}
add column iasp3

/* Robert kossvet, to find new picks remove these comments */
/* FILTER */
trad_grp_width between -1 and 1
inv_grp_width between -1 and 1

do not draw comp_score

86 posts
msg #150938
Ignore kossvet
2/26/2020 9:36:16 PM

Cheese thanks for the quick response. I'm gonna spend sometime with the filters, and try to understand the
the methodology. If by chance I figure it out exactly, I will definitely share it with the board.
Thanks again

244 posts
msg #150940
Ignore xarlor
2/26/2020 10:35:55 PM

kossvet, I concur with the others here. graft's work on Guppy filters embodies the theory you stumbled upon.

As for your specific request, here it is in its minimalist form. Change the 10 days to any other length to suit your needs.

average volume(30) > 500000

set{diff1,ma(5) - ma(10)}
set{diff2,ma(10) - ma(20)}

draw ma(5)
draw ma(10)
draw ma(20)

ma(5) increasing for last 5 days
ma(10) increasing for last 5 days
ma(20) increasing for last 5 days

diff1 increasing for the last 10 days
diff2 increasing for the last 10 days

86 posts
msg #150953
Ignore kossvet
2/27/2020 4:03:33 PM

Xalor thanks for the (help) reply.

I still need to include a long consolidation period in the filter.
This filter and Cheeses are very close.
How can you write the filter to include the long tight consolidation period?
I have been trading recently these low priced pharma stocks.
All of them had the same setup.
Just like Sava from Nov 2019 to Dec 2019.
I have found these stocks by chance.
But they all took off, from a long tight consolidation pattern.
Here are some of my most recent winners.
SAVA, GNPX, SNGX, CLSD, APTO, AQST, CYCN, to name a few.
I also have some losers that I did not mention.
I set aside 10k, just for these type stocks.
Over the last 4 months 10K turned into 22k including losers.
So there is something to this exact setup.
My hold period was always less than a month.
Sold some of them to early, SAVA especially comes to mind.
Can we put our heads together, and get this filter exact, and share it with the board
Thanks for your effort Cheese and Xalor

244 posts
msg #150963
Ignore xarlor
2/27/2020 8:58:57 PM

I took another whack at it. It's not perfect, but a lot closer. The recent correction makes near-term hits pointless as everything is tanking this week. I suggest jumping back a month to look at potential performance.

I'm looking for an average true range to be really small for 30 days. Then a volume explosion twice as much as the average of the previous 5 days while breaking into a new 3-month high. Finally, rising MAs along with their expansion away from each other.

average volume(5) > 100000

set{diff1,ma(5) - ma(10)}
set{diff2,ma(10) - ma(20)}

set{vol2,average volume(5) 5 days ago * 2}

set{var1,count(volume > vol2,1)}
set{var2,count(ma(5) increasing for last 3 days,1)}
set{var3,count(ma(10) increasing for last 3 days,1)}
set{var4,count(ma(20) increasing for last 3 days,1)}

set{var5,count(diff1 increasing for the last 2 days,1)}
set{var6,count(diff2 increasing for the last 2 days,1)}

set{var7,count(atr(30) 3 days ago < .2,1)}
set{var8,count(reached a new high 3-month high,1)}

set{buy1,var1 * var2}
set{buy2, buy1 * var3}
set{buy3, buy2 * var4}
set{buy4, buy3 * var5}
set{buy5, buy4 * var6}
set{buy6, buy5 * var7}
set{buy, buy6 * var8}
buy > 0
buy 1 day ago equals 0

/* Comment out the 2 lines above and uncomment the 2 lines below to see all hits within the last year */
/* chart-time is 14 months */
/* count(buy > 0,251) > 0 */

draw ma(5)
draw ma(10)
draw ma(20)

86 posts
msg #150965
Ignore kossvet
2/27/2020 9:44:27 PM


The first stock VXRT was exactly what I was looking for. I believe you might have it.
The set up was exactly what I have been looking at.
Can't thank you enough, God Bless.
I have been trying for over a month to write this filter, and you just bang it out.
Very impressive.
Any candidates this filter highlights, I will be sure to share with everyone.
Thanks again.

StockFetcher Forums · General Discussion · What is the best way to write this filter<< 1 2 >>Post Follow-up

*** Disclaimer *** 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. does not recommend particular securities., 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 2018 - 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