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

Re: [EquisMetaStock Group] How to count the number of occurences ?



PureBytes Links

Trading Reference Links


Peak function ....

Pretty neat - some time ago we devised our own piece of software to
determine peaks which we used to train some nets.  Now I note we
could have spared ourselves the effort and used good ol' MS for it
all.

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://tsatsaeod.ferra4models.com
http://www.ferra4models.com

--- In equismetastock@xxxxxxxxxxxxxxx, "Andrew Tomlinson"
<andrew_tomlinson@xxxx> wrote:
> 
> Jose
> 
> Some very cool coding. 
> 
> I liked Peak(1,x,.001) to define a line that resets at every new
peak. Any
> specific reason for using .001? (I note that the ZigZag function
won't allow
> a number less than .01)
> 
> Highest(If(pk=pk1,0,pk)) is very elegant as a way of defining a data
array
> excluding the highest value. I tend not to think of using highest() or
> lowest() because they include all loaded data, but that's not a
problem when
> the data array is already restricted in time, as in this case.
> 
> Are there any issues surrounding the use of Peak() that I should be
aware
> of? I don't use ZigZag based functions much because of the problems.
> 
> I would like to change this into a dynamic band so I can see the
effect over
> time. I'll take a crack at it myself first, but any hints welcome!
> 
> Thank you Jose
> 
> Andrew
> 
> 
> 
> 
> -----Original Message-----
> From: Jose [mailto:josesilva22@x...] 
> Sent: Thursday, March 10, 2005 10:47 PM
> To: equismetastock@xxxxxxxxxxxxxxx
> Subject: Re: [EquisMetaStock Group] How to count the number of
occurences ?
> 
> 
> 
> 
> Easier said than done.
> 
> Difficulties involved:
> 
> 1) Restrict peaks/troughs lookback to last 6 calendar months;
> 2) Find highest / 2nd highest / third highest/lowest peaks/troughs;
> 3) Get it coded into MetaStock without using the professional services 
> of a competent programmer. ;)
> 
> Try this:
> 
> ====================
> Peak/Trough averages
> ====================
> ---8<---------------------
> 
> { Average of three highest peaks / lowest
>   troughs in an oscillator over last 6 months }
> 
> { CCopyright 2005 Jose Silva
>   For personal use only
>   http://www.metastocktools.com }
> 
> { Oscillator/Indicator }
> x:=MACD();
> 
> { User input }
> lbMth:=Input("Lookback months",1,12,6);
> 
> { Restrict search to lookback period } StMnth:=LastValue(Month())-lbMth;
> StYear:=If(StMnth<1,  LastValue(Year())-1,LastValue(Year()));
> StMnth:=If(StMnth<1,StMnth+12,StMnth);
> lookback:=Year()>StYear
>  OR (Year()=StYear AND (Month()>StMnth
>   OR Month()=StMnth
>    AND DayOfMonth()>=LastValue(DayOfMonth())));
> 
> { Highest/2nd/3rd peak values }
pk:=If(lookback,Peak(1,x,.001),Lowest(x));
> pk1:=LastValue(Highest(pk)); pk2:=LastValue(Highest(If(pk=pk1,0,pk)));
> pk3:=LastValue(Highest(
>  If(pk=pk1 OR pk=pk2,0,pk)));
> 
> { Lowest/2nd/3rd trough values }
> tr:=If(lookback,Trough(1,x,.001),Highest(x));
> tr1:=LastValue(Lowest(tr)); tr2:=LastValue(Lowest(If(tr=tr1,0,tr)));
> tr3:=LastValue(
>  Lowest(If(tr=tr1 OR tr=tr2,0,tr)));
> 
> { Average of last 3 peak/trough values } avgPk:=(pk1+pk2+pk3)/3;
> avgTr:=(tr1+tr2+tr3)/3;
> 
> { Plot in own window }
> x;avgPk;avgTr
> 
> ---8<---------------------
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "Andrew Tomlinson" 
> <andrew_tomlinson@xxxx> wrote:
> > That was too easy. How about this one - I want to take the average of 
> > the three highest peaks in an unbounded oscillator over the last 6 
> > months (also the three lowest, but I'm assuming that will flow from 
> > the first answer).
> > 
> > Any takers?
> > 
> > Best
> > Andrew
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > From: Roy Larsen [mailto:rlarsen@x...]
> > Sent: Thursday, March 10, 2005 6:18 PM
> > To: equismetastock@xxxxxxxxxxxxxxx
> > Subject: Re: [EquisMetaStock Group] How to count the number of
> > occurences ?
> > 
> > 
> > Hi Marco
> > 
> > Is this what you mean?
> > 
> > R:=RSI(C,14);
> > Cum(R<10);
> > Cum(R<20 and R>=10);
> > Cum(R<30 and R>=20);
> > Cum(R<40 and R>=30);
> > Cum(R<50 and R>=40);
> > Cum(R<60 and R>=50);
> > Cum(R<70 and R>=60);
> > Cum(R<80 and R>=70);
> > Cum(R<90 and R>=80);
> > Cum(R>=90);
> > 
> > 
> > Kind regards
> > 
> > Roy
> > www.metastocktips.co.nz
> > 
> > 
> > 
> > ----- Original Message -----
> > From: "khamsina11" <Khamsina11@xxxx>
> > To: <equismetastock@xxxxxxxxxxxxxxx>
> > Sent: Friday, March 11, 2005 10:48 AM
> > Subject: [EquisMetaStock Group] How to count the number of
> > occurences ?
> >
> >
> > Hi,
> > 
> > I would like to know (for all the data available) the number of times 
> > an indicator has been within an interval.
> >
> > For example, with a RSI : 0-9, 10-19, 20-29..... until 100.
> >
> > Thanks for your help,
> > 
> > Marco
> 
> 
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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/