StockFetcher Forums · Filter Exchange · In the spirit of RSI Divergences<< 1 2 >>Post Follow-up
JinNJ46
22 posts
msg #103659
Ignore JinNJ46
12/7/2011 7:28:41 AM

Folks,
I'm a newbie with both SF and Technical Analysis. I'm studying RSI and am currently drilling down on divergences. For this bearish divergence scenario, the filter (should) produces candidates for trade. The trade is bear call spread with short strike > 1 STDEV OTM. The system is explained in a webcast on www,cboe.com. The index of interest in the webcast is Russell 2000; the filter below doesn't restrict the security type. The filter is a start but it doesn't capture the spririt of the trade premise. I'm looking for more dynamics and not a fixed 3 week timeframe for analysis.

Trade Premise
The underlying index makes higher highs while the RSI fails to make higher highs. The trade entry is a an down close once the divergence condition exists.

My global filter: price > 5, AV > 50000, optionable

Also, backtesting will help determine if 14 days is best but suggestions based on your experience is welcome. All coments and assistance is greatly appreciated. Many thanks.

/*CHECK TIME SPENT IN OVERBOUGHT TERRITORY*/
SET {WAS_OVERBOUGHT, COUNT(RSI(14) IS ABOVE 70, 15)}
SET {RSI_PERIOD_HIGH, RSI(14) 15 DAY HIGH}

/* HIGH PRICE REACHED A NEW HIGH THEN CLOSES DOWN*/
AND HIGH REACHED A NEW 3 WEEK HIGH 1 DAY AGO
AND CLOSE IS BELOW CLOSE 1 DAY AGO

/* RSI DID NOT MAKE A NEW HIGH*/
AND RSI(14) 1 DAY AGO IS BELOW RSI_PERIOD_HIGH

/* AND SECURITY WAS OVERBOUGHT SOMETIME DURING THE 3 WEEK PERIOD*/
AND WAS_OVERBOUGHT IS GREATER THAN 1

/*AND RSI(14) 1 DAY AGO CROSSED ABOVE 70 WITHIN THE LAST 15 DAYS*/

/* RSI IS OUT OF OVERBOUGHT TERRITORY*/
AND RSI(14) IS BELOW 70

ADD COLUMN RSI(14)
ADD COLUMN RSI_PERIOD_HIGH
ADD COLUMN WAS_OVERBOUGHT


reels
29 posts
msg #103671
Ignore reels
12/7/2011 1:43:04 PM

Fetcher[
/*CHECK TIME SPENT IN OVERBOUGHT TERRITORY*/
SET {WAS_OVERBOUGHT, COUNT(RSI(14) IS ABOVE 70, 15)}
SET {RSI_PERIOD_HIGH, RSI(14) 15 DAY HIGH}

/* HIGH PRICE REACHED A NEW HIGH THEN CLOSES DOWN*/
AND HIGH REACHED A NEW 3 WEEK HIGH 1 DAY AGO
AND CLOSE IS BELOW CLOSE 1 DAY AGO

/* RSI DID NOT MAKE A NEW HIGH*/
AND RSI(14) 1 DAY AGO IS BELOW RSI_PERIOD_HIGH

/* AND SECURITY WAS OVERBOUGHT SOMETIME DURING THE 3 WEEK PERIOD*/
AND WAS_OVERBOUGHT IS GREATER THAN 1

/*AND RSI(14) 1 DAY AGO CROSSED ABOVE 70 WITHIN THE LAST 15 DAYS*/

/* RSI IS OUT OF OVERBOUGHT TERRITORY*/
AND RSI(14) IS BELOW 70

ADD COLUMN RSI(14)
ADD COLUMN RSI_PERIOD_HIGH
ADD COLUMN WAS_OVERBOUGHT
]



Eman93
4,750 posts
msg #103757
Ignore Eman93
12/13/2011 10:34:06 PM

You mean like CREE today? lower low but RSI is higher...

JinNJ46
22 posts
msg #103766
Ignore JinNJ46
12/14/2011 7:32:24 AM

Yes, that is the premise. However, I am having trouble coding "lower lows" or "higher highs". For the time being I have settled on fixed timeframes of 10 days. Here is the snippet:

Fetcher[apply to symlist(IWM)
and close reached a new 10 day high 1 day ago
and close is below close 1 day ago

and RSI(14) 1 day ago is below RSI(14) 10 day high 1 day ago
]



I have backtested this for 2007-2008 which is the test period from the CBOE. This picks up most of the entries but not all so perhaps someone can help me uncover the reasons. The backtest did not pick up the entry on 1/16/2007. A subset of the data from YAHOO (the RSI is calculated in my spreadsheet) is below. The close price condition is met but the RSI condition is not met, According to the data below it should be. This raises a the question of data integrity. How do you people vet and prove the validity of the content. The again, the likely culprit is likely my code! Please review and help out if you can. Many thanks.

The RSI(14) on 1/12/2007 should meet the condition in the code above
Date Open High Low Close Volume RSI
12/18/06 79.06 79.21 77.63 77.91 47013800 58.70
12/19/06 77.45 78.11 77.1 77.86 54066400 49.10
12/20/06 77.62 78.26 77.62 77.98 43288200 48.64
12/21/06 77.99 78.35 77.31 77.62 49951400 52.66
12/22/06 77.59 77.75 77.05 77.11 31230400 49.29
12/26/06 77.33 78.22 77.3 78.21 21798200 44.93
12/27/06 78.37 79.17 78.35 79.14 39294000 54.36
12/28/06 79.03 79.28 78.65 78.78 28257400 60.51
12/29/06 78.66 78.99 77.99 78.03 30795200 57.30
1/3/07 78.68 79.12 77.22 78.16 54095400 51.18
1/4/07 77.89 78.59 77.28 78.37 45577600 52.11
1/5/07 78.02 78.37 76.7 76.73 57486800 53.70
1/8/07 76.95 77.3 76.23 76.43 46117200 42.08
1/9/07 77.12 77.31 76.19 77.15 62791800 40.38
1/10/07 76.76 77.75 76.57 77.75 49239300 46.07
1/11/07 77.46 78.54 77.4 78.23 49188300 50.36
1/12/07 78.26 79.05 78.13 78.98 28392800 53.50
1/16/07 79.21 79.36 78.3 78.45 33914700 58.01


TheRumpledOne
6,411 posts
msg #103768
Ignore TheRumpledOne
12/14/2011 7:39:56 AM

4/6/2011 2:11:54 AM

Fetcher[

/* TRO Positive Divergence 2 - 5 days*/

set{nd2,count(close below close 2 days ago,1) * count(rsi(2) above rsi(2) 2 days ago,1)}}

set{nd3,count(close below close 3 days ago,1) * count(rsi(2) above rsi(2) 3 days ago,1)}

set{nd4,count(close below close 4 days ago,1) * count(rsi(2) above rsi(2) 4 days ago,1)}

set{nd5,count(close below close 5 days ago,1) * count(rsi(2) above rsi(2) 5 days ago,1) }

Set{n1, nd5 * 1}
Set{n2, nd4 * 10}
Set{n3, nd3 * 100}
Set{n4, nd2 * 1000}

Set{na, n1 + n2}
Set{nb, n3 + n4}
Set{PD2345, na + nb}

/* POSDIV is the number of times there was a 2, 3, 4 or 5 day positive divergence during the past 10 days */

set{POSDIV, count(PD2345 above 0, 10)}

/* PDDAYS is the number of days since there hasn't been a 2, 3, 4 or 5 day positive divergence */

set{PDDAYS, days(PD2345 EQUAL 0, 100)}


set{rsidays,days(RSI(2) below 1, 15)}


set{T10, count(10 day slope of the close above 0,1)}
set{T60, count(60 day slope of the close above 0,1)}
set{T200, count(200 day slope of the close above 0,1)}

Set{u1, T200 * 1}
Set{u2, T60 * 10}
Set{u3, T10 * 100}

Set{uu, u1 + u2}
Set{TREND, uu + u3}


add column PD2345
add column posdiv
add column pddays



add column separator
add column trend

add column rsidays
add column rsi(2) 200 day low
add column separator
add column CMA(Day Point Range, 30)
add column separator


close above 1
avgvol(90) above 1000000

rsi(2) below rsi(2) 1 day ago

PD2345 above 0

sort column 5 descending

]



You may be able to adapt this filter.

TheRumpledOne
6,411 posts
msg #103769
Ignore TheRumpledOne
12/14/2011 7:41:52 AM

Fetcher[

/* TRO Low touched Dynamic Support */

/* PRICE POSITION PERCENT DISPLAY */

/* enter your Upper Limit criteria */
set{UpperLim, High 5 Day High}

/* enter your Lower Limit criteria */
set{LowerLim, Low 5 Day Low}
set{touch5d, count( low equal LowerLim , 1) }

/* enter your Lower Limit criteria */
set{LOW5w, Low 5 week Low}
set{DIFF5, CLOSE MINUS LOW5w }
set{touch5w, count( low equal LOW5w , 1) }

/* enter your Lower Limit criteria */
set{LOW13w, Low 13 week Low}
set{DIFF13, CLOSE MINUS LOW13w }
set{touch13w, count( low equal LOW13w , 1) }

/* enter your Lower Limit criteria */
set{LOW26w, Low 26 week Low}
set{DIFF26, CLOSE MINUS LOW26w }
set{touch26w, count( low equal LOW26w , 1) }

/* enter your Lower Limit criteria */
set{LOW52w, Low 52 week Low}
set{DIFF52, CLOSE MINUS LOW52w }
set{touch52w, count( low equal LOW52w , 1) }

set{touch3, touch5d + touch5w }
set{touch2, touch3 + touch13w }
set{touch1, touch2 + touch26w }
set{touch, touch1 + touch52w }

set{LimDiff, UpperLim minus LowerLim}
set{PPDiff, CLOSE minus LowerLim}
set{PPDiv, PPDiff / LimDiff}
set{BallOn, PPDiv * 100}

set{PCT, LimDiff / LowerLim}

set{HiOp,high - open}
set{OpLo, open - low}
set{ClLo, close - low}

set{CCb,days(close is above close 1 day ago,100)}
set{CCa,days(close is below close 1 day ago,100)}
set{ClxCl, CCa - CCb}

set{HHb,days(High is above High 1 day ago,100)}
set{HHa,days(High is below High 1 day ago,100)}
set{HixHi, HHa - HHb}

set{LLb,days(Low is above Low 1 day ago,100)}
set{LLa,days(Low is below Low 1 day ago,100)}
set{LoxLo, LLa - LLb}

/* column display */

add column ClxCl
add column HixHi
add column LoxLo

add column ClLo
add column HiOp
add column OpLo

add column BallOn
add column PCT

add column touch5d
add column touch5w
add column touch13w
add column touch26w
add column touch52w



add column DIFF5
add column DIFF13
add column DIFF26
add column DIFF52

add column LOW5w
add column LOW13w
add column LOW26w
add column LOW52w




/* PLOTS */

draw UpperLim on plot price
draw LowerLim on plot price

/* Selection Criteria */

set{BallLow, count( BallOn < 2 , 1 ) }
set{BallHigh, count( BallOn > 98 , 1 ) }
set{PlayBall, BallLow + BallHigh }

touch above 0
Close above 1
MARKET IS NASDAQ

volume above 1000000

add column industry

Sort column 5 ascending

/* DRAW LINES */

draw upperlim on plot price
draw lowerlim on plot price

draw LOW5w on plot price
draw LOW13w on plot price
draw LOW26w on plot price
draw LOW52w on plot price
]



You find this filter useful, too.

JinNJ46
22 posts
msg #103772
Ignore JinNJ46
12/14/2011 8:39:51 AM

Thanks TheRumpledOne for your assistance. Your code is a bit difficult for me to follow but I'll give it a go. Any comments on my code snippet and why the 1/15/2007 RSI condition is not picked up by SF?!

Eman93
4,750 posts
msg #103862
Ignore Eman93
12/19/2011 8:10:03 PM

Fetcher[


close > 1


volume > 800000

low reached a new 10 week low

set{rslo, 0 + rsi(14) 10 week low}

set{rsla, 0 + rsi(14) 3 week low}

set{rstoday, 0 + rsi(14)}

set{rdlo, rslo / rsla}

set{rdlp, 1 - rdlo}

set{rmda, rslo - rstoday}

set{rmdb, rslo - rsla}

rdlo < 1

draw rsi(14) 10 week low

add column rstoday

add column rsla {3w low}

add column rslo {10W low}

add column rmdb
add column rdlp



add column Volume Weighted Moving Average(14)

add column beta

add column IND

sort column 8 ascending
]



JinNJ46
22 posts
msg #103908
Ignore JinNJ46
12/21/2011 8:04:13 AM

Eman93,
Thanks so much for sharing. I see you filter screens for:

1. Stocks reahing a new low
2. An uptrending RSI for the period of 10 weeks ago - 3 weeks ago

This would represent a divergence of sorts. However, I do not see the correlation of RSI between today and 3 or 10 weeks in the past. I only see #2 above. Perhaps you meant to incude that analysis but didn't since the variable rmda seems to be an orphan

/***
set{rmda, rslo - rstoday}
***/

Is it a coincidence that today's RSI continues the uptrend?!

many thanks.

coolsf
21 posts
msg #103911
Ignore coolsf
12/21/2011 8:55:29 AM

Stockfetcher is not so good with the weekly indicators.

StockFetcher Forums · Filter Exchange · In the spirit of RSI Divergences<< 1 2 >>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.