volvlov 32 posts msg #148393 - Ignore volvlov |
7/5/2019 10:42:04 PM
I did some digging and apparently, other people have questioned Weinstein's erroneous equation for Relative Strength over the years. As far as I can tell, the equation in the below link is correct. Can someone please tell me how to embed filters? Also, as noted in the code, I believe daily charts need a 200 MA and weekly charts need a 52 MA.
https://www.tradingview.com/chart/LAC/K4K9vEtR-200-day-Mansfield-relative-strength-index-for-stage-analysis/
chart-time is 3 months
symlist(gol,htz,x,tsla)
set{ratio, close/ind(^ixic,close)}
/*200 for daily charts-52 for weekly*/
set{erat, cema(ratio,200)}
set{quo,ratio/erat}
set{dif,quo - 1}
set{MansfieldRS,dif*10}
draw MansfieldRS
add column MansfieldRS
draw MansfieldRS line at 0
|
Mactheriverrat 3,178 posts msg #148394 - Ignore Mactheriverrat |
7/5/2019 10:48:07 PM
An examples page.
Stage Analysis is a strategy for longer term trend trading. It was discussed in detail by Stan Weinstein in the book Secrets for Profiting in Bull and Bear Markets. Stage Analysis uses chart patterns to describe four distinct stages that a particular trade can be in.
|
Mactheriverrat 3,178 posts msg #148395 - Ignore Mactheriverrat |
7/5/2019 11:07:08 PM
Wonder if someone can code the below with a weekly MA52
set{erat, cema(ratio,200)}
set{quo,ratio/erat}
set{dif,quo - 1}
set{MansfieldRS,dif*10}
draw MansfieldRS
add column MansfieldRS
draw MansfieldRS line at 0
|
volvlov 32 posts msg #148396 - Ignore volvlov |
7/5/2019 11:14:09 PM
chart-time is 15 months
symlist(gol,htz,x,tsla)
set{ratio, close/ind(^ixic,close)}
/*200 for daily charts-52 for weekly*/
set{erat, cema(ratio,52)}
set{quo,ratio/erat}
set{dif,quo - 1}
set{MansfieldRS,dif*10}
draw MansfieldRS
add column MansfieldRS
draw MansfieldRS line at 0
chart-display is weekly
|
Mactheriverrat 3,178 posts msg #148398 - Ignore Mactheriverrat modified |
7/6/2019 2:40:49 AM
@volvloe
Submit
|
davesaint86 726 posts msg #148409 - Ignore davesaint86 |
7/7/2019 12:10:50 AM
code from TradingView
//@version=3
// Use this indicator to compare how security is performing in compare with prefered index (SPX by default).
// > 0 outperforming
// < 0 underperforming
// Works best for weekly, but can be applied to monthly and daily charts. It will be rather useless to use it in smaller timeframes
// Apply it to SPX, industry index, sector index or other security in similar sector
// UPDATE 1: Added sector and industry as optional params. Leave them same as index if you don't want to use them
study("Mansfield Relative Strength indicator")
index = input(title="Index", type=symbol, defval="SP:SPX")
sector = input(title="Sector (optional)", type=symbol, defval="SP:SPX")
industry = input(title="Industry (optional)", type=symbol, defval="SP:SPX")
ma_type = input(title="Which moving average to use?", defval="SMA", options=["SMA", "WMA", "EMA"])
len_daily = input(title="MA length for Daily", defval=200)
len_weekly = input(title="MA length for Weekly", defval=52)
len_monthly = input(title="MA length for Monthly", defval=10)
len_other = input(title="MA length for all other periods", defval=52)
val = close
len = period == "W" ? len_weekly : (period == "D" ? len_daily : (period == "M" ? len_monthly : len_other))
ma_func(x, length) =>
ma_type == "WMA" ? wma(x, length) : (ma_type == "SMA" ? sma(x, length) : ema(x, length))
calc_mrs_func(x, ind, length) =>
((x / security(ind, period, x)) / ma_func((x / security(ind, period, x)), length) - 1) * 10
mrs_index = calc_mrs_func(val, index, len)
mrs_sector = calc_mrs_func(val, sector, len)
mrs_industry = calc_mrs_func(val, industry, len)
c = sign(mrs_index) + sign(mrs_sector) + sign(mrs_industry)
bgcolor(c == 3 ? color(green, 80) : c == 2 ? color(green, 75) : c == 1 ? color(green, 70) : c == -1 ? color(red, 70) : c == -2 ? color(red, 75) : c == -3 ? color(red, 80) : gray)
plot(mrs_index, linewidth=3, title="MRS index")
plot(mrs_sector != mrs_index ? mrs_sector : na, linewidth=2, title="MRS sector")
plot(mrs_industry != mrs_index ? mrs_industry : na, linewidth=1, title="MRS industry")
hline(price=0, linestyle=dashed, title="Zero baseline")
|
davesaint86 726 posts msg #148413 - Ignore davesaint86 |
7/7/2019 11:33:49 AM
https://www.tradingview.com/x/MwjLOJFP/
https://www.tradingview.com/x/7S4tx1oq/
|
Mactheriverrat 3,178 posts msg #148505 - Ignore Mactheriverrat modified |
7/13/2019 8:45:00 PM
Submit
You should see charts like this

|
davesaint86 726 posts msg #148506 - Ignore davesaint86 modified |
7/13/2019 9:30:19 PM
I found the Weinstein filter on ChartMill and here is their current list. Many of these stocks are still in stage 2.
|
Mactheriverrat 3,178 posts msg #148507 - Ignore Mactheriverrat |
7/13/2019 9:40:28 PM
@davesaint86
Chartmill is another great site. Kudo's on your filter.
I like Weinstein's way of finding trends on the weekly charts.
|