PureBytes Links
Trading Reference Links
|
Sharad,
I see several problems which need to be adressed.
First problem is the use of a trough function. Here is the definition
straight from the program files in your copy of metastock.
-------------------------------
SYNTAX troughbars( Nth, DATA ARRAY, % MINIMUM CHANGE)
FUNCTION Plots the number of bars that have passed from the
Nth trough.
This uses the Zig Zag function (see Zig Zag) to determine the
troughs. If Nth
is 1, then this will return the number of bars that have passed since
the most
recent trough. If Nth is 2, this will return the number of bars that
have passed
since the 2nd most recent trough. Etc.
EXAMPLE troughbars(1,close,5)
----------------------------
Notice that trough uses the zig zag function. This function is not
constant. Today's signal will not match tomorrow's signal.
Next problem is in the formula that you are working with.
The formula is subtracting the troughbar count of the low from a RSI.
The formula for the RSI normally uses close and tabulates the
momentum of the close either up or down. Low is not part of its
equation. I do see what you are attempting and there are other ways
to approach a divergence. To get some other ideas try doing a search
on divergence on this site and the Equis Forum site and I think you
will see some interesting applications that can be useful in your
case.
If you want to use troughbars with the RSI then I would suggest the
following although I do not advise using troughbars or troughs at
all. Plot this as an indicator in a separate window with the second
occurrence and I think you will see that the second occurrence will
always be greater. Like this:
TroughBARS(1,RSI(14),5);
TroughBARS(2,RSI(14),5);
Note that troughbars are simply a bar count until the next
occurrence. You will see a change if you use troughs instead. Like
this:
Trough(1,RSI(14),5);
Trough(2,RSI(14),5);
The problem with either of these is the reliability of the indicator.
As a matter of fact put it all together and I think you will find
this very interesting. It's a great way to study what you are trying
to do. Like this:
{Sharads Study}
RSI(14);
Trough(1,RSI(14),5);
Trough(2,RSI(14),5);
TroughBARS(1,RSI(14),5);
TroughBARS(2,RSI(14),5);
{end}
Troughbars will be at the bottom. Troughs will interlace throughout
the RSI. You will notice that the 2nd occurrence of troughs isn't
relevant.
Finally, the ref function will take a variable for time but it has to
be done by way of a variable DLL. This is the exact reason why they
were created. In your case though it is not necessary.
One last point is that there is a copy of the Metastock users manual
in our files section. You can also do exactly what I have done at
anytime while you are in the program by simply clicking on the "help"
icon. It is a great resource and right there for you at all times.
Hope this helps,
Preston
--- In equismetastock@xxxxxxxxxxxxxxx, "SHARAD LOHIA"
<sharadlohia@xxx> wrote:
>
> i currently have something like this
>
> L < Trough(1,L,5) and
> Trough(1,L,5) < Trough(2,L,5) AND
> REF(RSI(14),-TroughBARS(1,L,5)) > REF(RSI(14),-TroughBARS(2,L,5))
>
> but obviously the ref function does not take a variable for time -
so am stuck with that
>
> this shud give me the last 2 bottoms in price - but getting teh RSI
values at that time is the problem
>
> SHARAD LOHIA
>
> ----- Original Message -----
> From: pumrysh
> To: equismetastock@xxxxxxxxxxxxxxx
> Sent: Wednesday, May 28, 2008 9:54 PM
> Subject: Re: [EquisMetaStock Group] Coding an exploration and
expert advisor.
>
>
> Sharad,
>
> Will help if you show us what you already have.
>
> Preston
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "SHARAD LOHIA"
> <sharadlohia@> wrote:
> >
> > Can anybody pls help or guide
> >
> > I want to program a Triple Divergence Indicator where price
makes 3
> consecutive lower lows with intermediate rallies of 5% and the
RSI
> Indicator has made higher bottoms on each successive lower low of
> price.
> >
> > I have been able to program the price making 3 lower bottoms
but am
> unable to program the RSI 3 higher bottoms. The problem i am
facing
> is how to store the value of RSI when the first and second lower
> bottom was made - so as to be able to compare it with the current
RSI
> value.
> >
> > regards
> > SHARAD LOHIA
> >
> > ----- Original Message -----
> > From: rbw1226
> > To: equismetastock@xxxxxxxxxxxxxxx
> > Sent: Tuesday, May 27, 2008 7:05 PM
> > Subject: [EquisMetaStock Group] Coding an exploration and
expert
> advisor.
> >
> >
> > Coding an exploration and expert advisor.
> >
> > I have tried to code an exploration containing these indicators:
> >
> > Example of Alcoa Inc. - AA
> > 16th 19th 20th
> > RSI 74.5878 77.8750 68.8206
> > STOCH 82.2645 86.6776 80.1709
> > MACD 1.62294 1.83796 1.88434
> > SMI 85.2341 88.5809 84.9160
> > 3Period MA(S)42.6300 43.4933 43.6567
> > Close 43.15 44.59 43.23
> >
> > Each are default but would like to know how to code if changing
> > default.
> > What I am trying to do is based on values changing from uptrend
> to
> > signal/display values plus I reckon -1 or difference.(also if
> > changing from downtrend)
> > For example each column would display like.
> > RSI 68.8206 with a -1 or difference of value change being -
9.0544
> > from previous.
> > STOCH 80.1709 -1 or -6.5067
> > MACD 1.88434 +1 or +.04638
> > SMI 84.9160 -1 or -3.6649
> > 3Period MA(S) 43.6567 +1 or + .1634
> > Close 43.23 -1 or -1.36
> >
> > If this is not possible would it be possible to only display
> values
> > when a change from previous 2 periods trend occurs. Which only
> the
> > MACD and 3periodma would not display a value or signal in this
> case.
> > Or better yet would display value with also a 0 indicating no
> change
> > in trend.
> >
> > Thanks a lot in advance because I think I must be asking and
> trying
> > for something not possible. As for making this an expert
advisor
> I
> > was thinking of when close crossed 3periodma and at least 2
> > indicators changed trend.
> >
> > Thanks again
> > Burt
> >
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|