PureBytes Links
Trading Reference Links
|
Terry, the posted indicator shows the *average* closing price
difference in up (and down) bars, as set out in your original request:
"[if(c>ref(c,-1),c-ref(c,-1),0)]"
For ATR Up/Down bars,
change:
---8<----------------
diff:=If(type=1,C-Ref(C,-1),
(C/Ref(C,-1)-1)*100);
---8<----------------
to:
---8<----------------
diff:=ATR(1);
---8<----------------
Once you've adjusted the indicator code to measure ATR instead of C-
Ref(C,-1), for strict (un-smoothed) ATR Up/Down bars set the SMA
periods to "1".
For additional help on this matter, please consider employing the
professional services of a competent MetaStock programmer.
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, projosc <no_reply@xxx> wrote:
>
> Thanks Jose. I don't know what this indicator shows, but it is not
> up bars ATR.
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" <josesilva22@>
> wrote:
>
> Terry, try this indicator:
>
> ====================
> Up/Down bar averages
> ====================
> ---8<-------------------------
>
> { From: http://www.metastocktools.com }
>
> { User inputs }
> pds:=Input("SMA periods",1,260,5);
> type:=Input("plot: [1]Difference, [2]Percentage",1,2,1);
>
> { Difference: Momentum or RoC% }
> diff:=If(type=1,C-Ref(C,-1),
> (C/Ref(C,-1)-1)*100);
>
> { Up bars }
> up:=C>Ref(C,-1);
> upDiff:=up*diff;
> upAvg:=Sum(upDiff,pds)/Max(Sum(up,pds),1);
>
> { Down bars }
> dw:=C<Ref(C,-1);
> dwDiff:=dw*diff;
> dwAvg:=Sum(dwDiff,pds)/Max(Sum(dw,pds),1);
>
> { Plot in own window }
> upDiff;upAvg;
> dwDiff;dwAvg
>
> ---8<-------------------------
>
>
> jose '-)
> http://www.metastocktools.com
>
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, projosc <no_reply@> wrote:
>
> Hello new friends. Perhaps someone can help me with this. I want
> to create an average true range of up days separate from down days.
> If I use the if() function, it returns the values I want
> [if(c>ref(c,-1),c-ref(c,-1),0)] but also returns zeros for the
> down bars. This causes the moving average to be miscalculated.
> How do I return only the positve values with no zeros and then
> devide by the apropriate number? Thanks
> and I hope this will help others also. Terry
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> 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/
|