PureBytes Links
Trading Reference Links
|
<SPAN
class=486380318-18102002>Bill,
<SPAN
class=486380318-18102002>
a continuation of
our discussion on another board...... Here is an example of how we might code a
variable ATR to see how it relates to a stocks expected daily range in terms of
percent. The concept may also lend itself to explorations looking for break
outs/downs
<SPAN
class=486380318-18102002>
<SPAN
class=486380318-18102002>
*****Variable
ATR*******
<FONT color=#282828
size=2>
x=8<FONT color=#282828
size=2>;//variable setting for zig look
back
top=Peak<FONT color=#282828
size=2>(C<FONT color=#282828
size=2>,x);
bott=Trough<FONT color=#282828
size=2>(C<FONT color=#282828
size=2>,x);
Ctop=ValueWhen<FONT color=#282828
size=2>(C<FONT color=#282828
size=2>==top,Cum<FONT color=#282828
size=2>(1<FONT color=#282828
size=2>),1<FONT color=#282828
size=2>);//marks
top
Cbot=ValueWhen<FONT color=#282828
size=2>(C<FONT color=#282828
size=2>==bott,Cum<FONT color=#282828
size=2>(1<FONT color=#282828
size=2>),1<FONT color=#282828
size=2>);//marks
bott
PorT=IIf<FONT color=#282828
size=2>(Ctop>=Cbot,Ctop,Cbot);<FONT color=#008000
size=2>//count from <FONT
color=#008000 size=2>peak or trough count
Count1=Cum<FONT color=#282828
size=2>(1<FONT color=#282828
size=2>);
Count=LastValue<FONT color=#282828
size=2>(Count1-port,1<FONT
color=#282828 size=2>);//makes
variable constant
Varatr=ATR<FONT color=#282828
size=2>(Count);
Plot(Varatr,<FONT color=#ff00ff
size=2>"ATR % ="+<FONT color=#0000ff
size=2>WriteVal(Varatr/<FONT
color=#000000 size=2>C*<FONT
color=#ff00ff size=2>100)+<FONT
color=#ff00ff size=2>" current ATR Lookback="<FONT color=#282828
size=2>+WriteVal<FONT color=#282828
size=2>(Count)+" Var ATR Value"<FONT
color=#282828 size=2>,<FONT color=#000000
size=2>colorWhite,<FONT
color=#ff00ff size=2>4<FONT color=#282828
size=2>);
Jayson
|