PureBytes Links
Trading Reference Links
|
Hi Philip
The first thing to be aware of is that my weekly ADX is based on the following "ADX Raw" code.
{MetaStock code written by Equis and published in the Oct99 TASC}
{ADX Raw}
Periods:=Input("Enter time periods",1,100,10);
PlusDM:=If(H>Ref(H,-1) AND
L>=Ref(L,-1),H-Ref(H,-1),
If(H>Ref(H,-1) AND L<Ref(L,-1)
AND H-Ref(H,-1)>Ref(L,-1)-L,
H-Ref(H,-1),0));
DIPlus:=100*Wilders(PlusDM,Periods)/ATR(Periods);
MinusDM:=If(L<Ref(L,-1) AND
H<=Ref(H,-1),Ref(L,-1)-L,
If(H>Ref(H,-1) AND L<Ref(L,-1)
AND H-Ref(H,-1)<Ref(L,-1)-L,
Ref(L,-1)-L,0));
DIMinus:=100*Wilders(MinusDM,Periods)/
ATR(Periods);
DIDif:=Abs(DIPlus - DIMinus);
DISum:=DIPlus + DIMinus;
100*Wilders(DIDif/DISum,Periods);
For a number of reasons this code gives a slightly different result than the canned MS version (on
any periodicy). One of the reasons is that the canned version is "rounded" to a whole number and the
above version is not. There are other subtle differences that I can't quite put my finger on.
If you drop the above code on a weekly chart and then overlay my weekly code on the same chart you
should see that they are identical, or almost anyway. If you then overlay the canned MS "Directional
Movement ADX" you'll see the differences I'm talking about. Use different colours for each plot.
> Thank you very much, Roy. I'm especially interested in the weekly ADX.
>
> I'd like to build an expert on my daily charts with highlights or symbols identifying bars where
BOTH weekly and daily adx are rising -- and the trend is up. Can you show me how to amend the weekly
ADX to achieve this? Am I correct that the weekly ADX as you have it returns a true on the daily
chart when the ADX rises but not for the duration of the week? Rather confused, sorry.
Just be aware that the Weekly ADX uses PREV functions to create Wilders Smoothing within the
indicator. This will add overheads to your expert that will be particularly noticeable when a large
number of daily bars are loaded, say above 1000. Just something to be aware of. Of course if you
reduce the number of daily bars too much your weekly values will be less accurate which is something
of a "catch 22" situation.
To convert my code to plot a ONE (true) when the weekly ADX is rising change the last line to turn
it into a named variable
from
100*If(ValueWhen(N+1,J,F)>0,F,F);
to
X:=100*If(ValueWhen(N+1,J,F)>0,F,F);
then add the following line which tests the current value of the plot relative to the previous weeks
value
X>ValueWhen(2,J,X);
The last two lines will now appear like this
X:=100*If(ValueWhen(N+1,J,F)>0,F,F);
X>ValueWhen(2,J,X);
You can use this binary value and perform a similar test with the daily ADX() to verify that both
daily and weekly are rising. Your usual trend indicator can also be added to the mix.
> Am I correct that the weekly ADX as you have it returns a true on the daily chart when the ADX
rises but not for the duration of the week? Rather confused, sorry.
The weekly ADX (or any other weekly indicator for that matter) will plot a new value on a daily
chart once the end of week is known, and it will hold that value until the completion of the next
week. Try the indicators out and check out the various options. You will soon become familiar with
when the plot changes and why.
The "Display" mode has three options.
Zero will update the indicator as soon as there is a verified Friday bar. This option will allow the
indicator to update when the DayOfWeek()=5 AND the preceding bar also belongs to the current week.
There is a good reason for having two bars in the current week and the explanation has to do with
the possible makeup of contiguous weeks for thinly traded issues, short term suspensions, and other
possible data gaps.
One will update the indicator as soon as there is a verified Friday bar, and it will update the
current weekly value with each new bar of the week. This means that the current week is dynamic and
will change with each new daily bar until the Friday bar is added. This is consistent with the
MetaStock display of weekly periodicy charts constructed from daily data.
Two is the setting to use if back-testing. The indicator is not updated until the first bar of a new
week is added. The current value of the indicator always shows the value as at the end of the
previous week.
These options are effectively disabled when plotted on a weekly chart but range of weekly indicators
should exactly match the canned MS indicator on any weekly chart. All weekly indicators have a
mechanism to detect if the chart is weekly periodicy. This forces every bar to be considered as a
Friday or end-of-week bar.
Hope this helps some.
Roy
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|