Create Stan Weinstein 30 week moving average scan?


New member
Stan Weinstien's method uses 30 weeks or 10-week moving average, but it only counts Friday's close and ignores the rest of days' close data.

Does anyone know how to get that?

so below the script, we have CLOSE, but we need just Friday's CLOSE data.

input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 30;
input averageType = AverageType.SIMPLE;

plot MovAvg = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);


New member
@yaarione Just curious. Can you explain what would the scanner or Stan Weinstein's method provides? And what are the specifics you can share? I appreciated you. TIA.
I came across his methods and saw a scan requirements and this 30 WEEK MA is one of them.

it's his scan try to find stage 2 just happened or already in stage 2

scan details are here (but now seeing different criteria in some other sources)

my current TOS scan for this^^


do u know the formula?

The formula of this indicator is a bit more complicated than the regular Dorsey RS, but it is worth the read:

RSM = (( RSD(today) /sma(RSD(today), n)) - 1 ) * 100


So, the Dorsey Relative Strength value is divided by its own n-day moving average and then one is subtracted. If we look at the daily time frame and use 200 for n, this means:

  • We get 0 if the RSD is exactly equal to its 200 day moving average.
  • We get a negative number if the RSD is below its 200 day moving average.
  • We get a positive number if the RSD is above its 200 day moving average.
Most Technical analysts are familiar with the stock price being above or below a certain Simple Moving Average. With Mansfield RS, the same applies: if the relative strength is above its moving average, positive values are seen, if it is below, we see negative values.

Using Mansfield Relative Strength

As with the regular ( Dorsey ) RS, you can use Mansfield RS to examine if a stock performs better than the market. Only the rising or declining of the indicator matters for this.

Stan Weinstein used the indicator only on weekly charts with 52 as the parameter value for n. He insisted that break outs out of a base had to go together with rising relative strength. The Mansfield RS needs to be rising an close to or above 0.

This indicator has the advantage over the Dorsey RS that the values are below or above the 0 line. This allows us to screen for stocks with a MRS value above 0. When we see that the MRS is far above 0 and has been above 0 for some time, we have found a stock that outperforms the market heavily. We can buy this kind of stock when dips occur.

This screen is a modification of the weekly ChartMill Channel breakout screen, which adds the criteria of a rising Mansfield Relative Strength.


@yaarione I am using currently Relative strength (SPY) to compare the particular stock.

declare lower;

input CorrelationWithSecurity = "SPY";
def close2 = close(CorrelationWithSecurity);

plot RS = if close2 == 0 then 0 else close/close2;

def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
plot SRatio =  sr;

I also have added cloud to the above-
Plot Zeroline = 0;

Similar threads