[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: mov(positive integers only)



PureBytes Links

Trading Reference Links

Well, not exactly. It plots the up/dn bars atr() that are in the 
lookback period. If there are no up or dn bars in the lookback period 
it plots zero. i was wanting to plot the last number of up/dn bars atr
() no matter how far it had to "lookback".

--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" <josesilva22@xxx> 
wrote:
>
> 
> My suggestion is that you take another look at my solution, as it 
> plots *exactly* what you have asked for.
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, projosc <no_reply@> wrote:
> >
> > This is what I have come up with for an up bars atr(5). It does 
not 
> > seem acurate though as it does not oscillate over and under the 
> > regular atr(5) as expected. Any sugestions?
> > 
> > If(Sum(C>Ref(C,-1),5)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),5))/5,If(Sum(C>Ref(C,-1),6)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),6))/6,If(Sum(C>Ref(C,-1),7)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),7))/7,If(Sum(C>Ref(C,-1),8)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),8))/8,If(Sum(C>Ref(C,-1),9)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),9))/9,If(Sum(C>Ref(C,-1),10)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),10))/10,If(Sum(C>Ref(C,-1),11)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),11))/11,If(Sum(C>Ref(C,-1),12)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),12))/12,If(Sum(C>Ref(C,-1),13)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),13))/13,If(Sum(C>Ref(C,-1),14)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),14))/14,If(Sum(C>Ref(C,-1),15)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),15))/15,If(Sum(C>Ref(C,-1),16)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),16))/16,If(Sum(C>Ref(C,-1),17)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),17))/17,If(Sum(C>Ref(C,-1),18)=5,
> > (Sum(If(C>Ref(C,-1),ATR(1),0),18))/18,0))))))))))))))
> > 
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, eslam_h2022 <no_reply@> 
> > wrote:
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" 
> > <josesilva22@> wrote:
> >
> > 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@> 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 Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
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/