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

[EquisMetaStock Group] Data-bar Stats indicator



PureBytes Links

Trading Reference Links


The MetaStock indicator below may be useful for determining chart 
average bar-count per year, as well as other basic data statistics.

Elements of the code (such as "First year of loaded chart data") may 
also be useful in their own right.


MetaStock -> Tools -> Indicator Builder -> New
Copy and paste indicator formula below.

=========
Bar Stats
=========
---8<---------------------

{ Data bar statistics v1.0 }
{ Display in own window, then Zoom & Reset }
{ Irregular yearly data bar counts indicate
   missing data and/or illiquid chart }
{ ©Copyright 2005 Jose Silva
  For personal use only
  http://www.metastocktools.com }

{ User inputs }
display:=Input("Count:  [1]Year's bars,  [2]Years,  [3]Bars",1,3,1);
type:=Input("Stats:  [1]Individual years',  [2]Avg/Total",1,2,1);

{ First year of loaded chart data }
year1:=ValueWhen(1,Cum(1)=1,Year());
year1flag:=Year()=year1;

{ Yearly bar stats }
yStart:=Year()<>Ref(Year(),-1);
yearStart:=yStart OR Cum(IsDefined(yStart))=1;
yearCount:=Cum(yearStart)-1;
yearBars:=BarsSince(yearStart)+1+year1flag;
YearStats:=If(display=1,yearBars,
 If(display=2,yearCount,Cum(1)));

{ Total/Avg bar stats }
barCount:=LastValue(Cum(1));
yearCount:=LastValue(Year())-year1;
yearlyAvgBars:=Int(barCount/yearCount+.5);
TotalStats:=If(display=1,yearlyAvgBars,
 If(display=2,yearCount,barCount));

{ Plot in own window below price chart }
If(type=1,YearStats,TotalStats)

---8<---------------------


jose '-)
http://www.metastocktools.com









------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/