PureBytes Links
Trading Reference Links
|
// ADX/DMI
Indicator
range = <FONT
face="Courier New" color=#0000ff size=1>Prefs<FONT face="Courier New"
size=1>( 49<FONT
face="Courier New" size=1> );
<FONT face="Courier New" color=#0000ff
size=1>_N( ranstr = <FONT
face="Courier New" color=#ff00ff size=1>"("<FONT face="Courier New"
size=1>+<FONT face="Courier New" color=#0000ff
size=1>WriteVal( range, <FONT
face="Courier New" color=#ff00ff size=1>1.0<FONT face="Courier New"
size=1> )+")"<FONT
face="Courier New" size=1> );
Plot<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>ADX(range), <FONT
face="Courier New" color=#ff00ff size=1>"ADX"<FONT face="Courier New"
size=1> + ranstr, -<FONT face="Courier New" color=#ff00ff
size=1>9, <FONT face="Courier New"
color=#ff00ff size=1>5 );<FONT
size=1>
Plot<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>PDI(range), <FONT
face="Courier New" color=#ff00ff size=1>"+DI"<FONT face="Courier New"
size=1> + ranstr, -<FONT face="Courier New" color=#ff00ff
size=1>16 );
Plot<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>MDI(range), <FONT
face="Courier New" color=#ff00ff size=1>"-DI"<FONT face="Courier New"
size=1> + ranstr, -<FONT face="Courier New" color=#ff00ff
size=1>8 );
//--Indicator-End-- --
do NOT remove this line!
//<FONT
size=1>
// DMI/ADX Commentary
// Copyright (C)2002
amibroker.com
Ad = Graph0;<FONT
size=1>
pd = Graph1;<FONT
size=1>
md = Graph2;<FONT
size=1>
ep = <FONT face="Courier New"
color=#0000ff size=1>IIf( pd > md,
ValueWhen<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>Cross( pd, md ), Low ),
ValueWhen<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>Cross( md, pd ), High )
);
good = <FONT face="Courier New"
color=#0000ff size=1>IIf( pd > md,
High > ep,
Low < ep );
bs = IIf<FONT
face="Courier New" size=1>( pd > md,
BarsSince<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>Cross( pd, md ) ),
BarsSince<FONT
face="Courier New" size=1>( <FONT face="Courier New" color=#0000ff
size=1>Cross( md, pd ) )
);
"Directional movement:"<FONT face="Courier New"
size=1>;
"Plus directional movement index line (+DI) is currently "<FONT
face="Courier New" size=1>+<FONT face="Courier New" color=#0000ff
size=1>
WriteIf( pd > md,<FONT
face="Courier New" color=#ff00ff size=1>"above"<FONT face="Courier New"
size=1>, <FONT face="Courier New" color=#ff00ff
size=1>"below")+<FONT
face="Courier New" color=#ff00ff size=1>
" minus directional movement index (-DI)"<FONT face="Courier New"
size=1>;
"It crossed "+ <FONT
face="Courier New" color=#0000ff size=1>
WriteIf( pd > md, <FONT
face="Courier New" color=#ff00ff size=1>"above"<FONT face="Courier New"
size=1>, <FONT face="Courier New" color=#ff00ff
size=1>"below" )
+ " "<FONT
face="Courier New" size=1> + <FONT face="Courier New" color=#0000ff
size=1>
WriteVal( bs, <FONT
face="Courier New" color=#ff00ff size=1>1.0<FONT face="Courier New"
size=1> ) + " bars
ago.\n";
"Welles Wilder (the author of Directional Movement indicator) suggests buying
when the +DI rises above the -DI and selling when the +DI falls below the
-DI.";<FONT face="Courier New"
color=#0000ff size=1>
WriteIf( bs < <FONT
face="Courier New" color=#ff00ff size=1>4<FONT face="Courier New"
size=1>,
"\nSince the crossover happened just recently, this may be a good opportunity
to enter " + <FONT
face="Courier New" color=#0000ff size=1>
WriteIf( pd > md, <FONT
face="Courier New" color=#ff00ff size=1>"long"<FONT face="Courier New"
size=1> , <FONT face="Courier New" color=#ff00ff
size=1>"short" ) + <FONT
face="Courier New" color=#ff00ff size=1>
" trade (or close already open "<FONT face="Courier New"
size=1>+
WriteIf( pd > md, <FONT
face="Courier New" color=#ff00ff size=1>"short"<FONT face="Courier New"
size=1>, "long"<FONT
face="Courier New" size=1>)+<FONT face="Courier New" color=#ff00ff
size=1>
" trade (if any)\n",<FONT
face="Courier New" color=#ff00ff size=1>
"\nCrossover happened more than 3 bars ago, so it is too late to act on this
signal.\n")+<FONT
face="Courier New" color=#0000ff size=1>
WriteIf( bs < <FONT
face="Courier New" color=#ff00ff size=1>4<FONT face="Courier New"
size=1>,
"Wilder, however, suggest to qualify simple +DI/-DI crossover with 'extreme
point rule'. When the +DI rises above the -DI, the extreme price is the high
price on the day the lines cross. When the +DI falls below the -DI, the extreme
price is the low price on the day the lines cross. The extreme point is then
used as a trigger point at which you should implement the trade.\n"<FONT
face="Courier New" size=1>,<FONT face="Courier New" color=#ff00ff
size=1>"")+ <FONT
face="Courier New" color=#0000ff size=1>
WriteIf( bs < <FONT
face="Courier New" color=#ff00ff size=1>4<FONT face="Courier New"
size=1>, "Current extreme
point value is " + <FONT
face="Courier New" color=#0000ff size=1>
WriteVal( ep ) + <FONT
face="Courier New" color=#ff00ff size=1>"."<FONT face="Courier New"
size=1> +
WriteIf( good, <FONT
face="Courier New" color=#ff00ff size=1>" Since today's "<FONT
face="Courier New" size=1> + <FONT face="Courier New" color=#0000ff
size=1>
WriteIf( pd > md, <FONT
face="Courier New" color=#ff00ff size=1>
"high ("+<FONT
face="Courier New" color=#0000ff size=1>WriteVal<FONT face="Courier New"
size=1>( High ) +")
is higher", <FONT
face="Courier New" color=#ff00ff size=1>
"low ("+<FONT
face="Courier New" color=#0000ff size=1>WriteVal<FONT face="Courier New"
size=1>(Low)+") is
lower" ) + <FONT
face="Courier New" color=#ff00ff size=1>
" than extreme point so the rule is fulfilled and "<FONT
face="Courier New" size=1> + <FONT face="Courier New" color=#0000ff
size=1>
WriteIf( pd > md, <FONT
face="Courier New" color=#ff00ff size=1>"buy"<FONT face="Courier New"
size=1>,"sell"<FONT
face="Courier New" size=1>)+<FONT face="Courier New" color=#ff00ff
size=1>
" signal is confirmed.\n"<FONT face="Courier New"
size=1>,
"Until now this rule is NOT fulfilled, so it is suggested to wait for the
confirmation.\n"),<FONT
face="Courier New" color=#ff00ff size=1>""<FONT face="Courier New"
size=1>);
falling = <FONT face="Courier New" color=#0000ff
size=1>ROC( Ad, <FONT
face="Courier New" color=#ff00ff size=1>2
) < 0<FONT
face="Courier New" size=1>;
strength = <FONT face="Courier New" color=#0000ff
size=1>IIf( Ad < <FONT
face="Courier New" color=#ff00ff size=1>15<FONT face="Courier New"
size=1> OR ( Ad < <FONT face="Courier New" color=#ff00ff
size=1>25 AND falling ),
0<FONT
face="Courier New" size=1>,
IIf<FONT
face="Courier New" size=1>( Ad < <FONT face="Courier New"
color=#ff00ff size=1>25 OR ( Ad
< 35<FONT
face="Courier New" size=1> AND falling ), <FONT face="Courier New"
color=#ff00ff size=1>1,
2<FONT
face="Courier New" size=1> ) );<FONT face="Courier New" color=#ff00ff
size=1>
"Trend strength:";<FONT
face="Courier New" color=#ff00ff size=1>
"The ADX is currently " + <FONT
face="Courier New" color=#0000ff size=1>WriteVal<FONT face="Courier New"
size=1>( Ad ) + " and
"
+WriteIf<FONT
face="Courier New" size=1>( falling, <FONT face="Courier New"
color=#ff00ff size=1>"falling.",
"rising."<FONT
face="Courier New" size=1> ); <FONT face="Courier New" color=#ff00ff
size=1>
"This suggests that the trend is "<FONT face="Courier New"
size=1>+
WriteIf( strength == <FONT
face="Courier New" color=#ff00ff size=1>0<FONT face="Courier New"
size=1>,
"rather weak or very weak. Important: when trend is weak directional movement
system generates signal too frequently and whipsaws can 'eat' all your
profits.", <FONT
face="Courier New" color=#0000ff size=1>
WriteIf( strength == <FONT
face="Courier New" color=#ff00ff size=1>2<FONT face="Courier New"
size=1>,
"rather strong.",<FONT
face="Courier New" color=#ff00ff size=1>
"medium in its strength."<FONT face="Courier New"
size=1>));
"\nThis commentary is not a recommendation to buy or sell. Use at your own
risk.";
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|