[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] incorrect RSI values between indicator plot and explorer results



PureBytes Links

Trading Reference Links

------------------------------------------------------------------------
You cannot reply to this message via email because you have chosen not
to disclose your email address to the group.

To reply:  http://groups.yahoo.com/group/equismetastock/post?act=reply&messageNum=5888
------------------------------------------------------------------------

Mike

Problems can occur visually if the scaling of an indicator is not set
correctly. However I suspect your real problem is that your exploration is
only for "Minimum" periods whereas it should be for at least 75 to 100
periods.

The problem is caused by the use of Wilders Smoothing within the RSI
calculation. Wilders Smoothing is a form of exponential moving average, and
the nature of an exponential moving average is that it retains a portion of
ALL data available - not just data for the designated number of periods. The
significance of this is that an RSI of 14 periods on a chart will contain a
greater amount of historical data than a 14 period RSI used with "minimum"
periods in an exploration.

The various formulas for EMA, Wilders and RSI are shown below and the
similarity between Wilders and an EMA is obvious. I have found that a good
"rule of thumb" is to multiply the longest EMA period by five to determine
how many periods the exploration should cover to give reasonable accuracy
(accurate to 3-4 decimal places).

  {Wilders Smoothing}
Period:=Input("Periods",1,99,14);
Target:=P;
Prcent:=1/Period;
Wsm:=If(Cum(1)=1,Target,PREV* (1-Prcent)+Target*Prcent);
Wsm;

  {Exponential Moving Average}
Period:=Input("Periods",1,99,14);
Target:=P;
Prcent:=2/(Period+1);
Ema:=If(Cum(1)=1,Target,PREV*(1-Prcent) + Target*Prcent);
Ema;

  {RSI Indicator}
A:=Input("RSI periods",2,50,14);
B:=CLOSE; {RSI target array}
U:=Wilders(If(B>Ref(B,-1),B-Ref(B,-1),0),A);
D:=Wilders(If(B<Ref(B,-1),Ref(B,-1)-B,0),A);
100-(100/(1+(U/D)));

Some months ago I posted the following information at StockCentral. This
lists a number of of functions that are affected by the same problem as RSI.
I hope this helps explain the issue sufficiently for you.

Roy

>From the number of questions that I have seen posted recently about
exploration events not coinciding with charted events I thought it might be
useful to discuss further the major cause of the problem, and to identify
many of the MetaStock functions that can contribute to it.

The problem does not lie with the MetaStock formula language but with the
way that individual users set up their explorations.

There seems to be a general lack of understanding, even among experienced
users, that EXPONENTIAL moving averages require much more data than the
"PERIODS" value of any affected function will supply. When using the
Explorer with the "Minimum Periods" option set we need to be aware that the
number of records explored will not exceed the highest "PERIODS" value used
in the active exploration formulas.

An EMA displayed on a chart has access to ALL loaded data, regardless of the
"PERIODS" value of the indicator. However an exploration will only have
access to the amount of data that the user has specified. The point to
remember with an exponential MA is that new data is added with each bar, but
old data is never dropped out (as happens with a simple MA). The old EMA
data becomes less significant with each new bar but it continues to be a
component of the final EMA value. This is the essential factor that causes
differences between chart and exploration values.

Quite a number of MetaStock functions use internal smoothing, and this is
usually (but not always) exponential in nature. Some functions allow user
control over the smoothing method employed, Mov() being an obvious example.

The following list cannot be guaranteed as 100% accurate but these are the
MS functions to watch out for that appear to use, or are in themselves, a
form of exponential smoothing.

adx()
adxr()
atr()
bbandbot()
bbandtop()
dema()
dx()
emv()
forecastosc()
imi()
inertia()
macd()
mass()
mdi()
mov()
oscp()
oscv()
pdi()
pfe()
projosc()
qstick()
rangeindicator()
rmi()
rvi()
sar()
stoch()
tema()
trix()
wilders()

When using any of these functions in an exploration the accuracy of the
reported results will require the number of records explored to be set
appropriately. As a rule of thumb I would suggest multiplying the highest
"PERIODS" value by a factor of 5.

Another trick that should force the exploration to include the required
minimum number of records without actually specifying that number is to add
the following code to the filter and adjust "PERIODS" to a suitable value.
" AND Mov(C,PERIODS,S)>0"




> Has anyone come across this before? In creating a simple formula to
> report on  crosses above 30 of a 14 period RSI, I find the values
> reported in the explorer report columns to be anywhere between 5% and
> 20-30% lower than those of the same indicator visually placed on the
> chart.
>
> In one case, the explorer report says '25' and '49' for two most recent
> periods yet the same indicator applied to the chart has '41' and '57'.
>
> To check that the indicator formula and the explorer formula were
> indeed mathematically the same, i have reprogrammed both using
> Ron's "Relative Strength Index - Custom V" formula from KALOSZ.
>
> I still report differences between the chart indicator and the explorer
> results to the same degrees above.
>
> Is this a computational limit of Metastock or something much more
> obvious?
>
> thanks, Mike
>
>
>
> To unsubscribe from this group, send an email to:
> equismetastock-unsubscribe@xxxxxxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>



To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/