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

[EquisMetaStock Group] Re: Bars Since 2nd Last Occurence



PureBytes Links

Trading Reference Links


Chaloke, try this MS code:

===================
BarsSince Nth event
===================
---8<--------------------------

{ ©Copyright 2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }

{ User inputs }
NthEvent:=Input("BarsSince Nth event  (1=last, 2=2nd last, etc)",1,
1000,2);
plot:=Input("plot:  [1]BarsSince Nth event,  [2]Event signals",1,2,1);

{ Event }
signal:=Cross(RSI(14),30);

{ Count events backwards }
count:=LastValue(Cum(signal))-Cum(signal)+1;

{ BarsSince Nth event }
BarsSinceNth:=
 HighestSinceBars(NthEvent+1,signal,count);

{ Plot in own window }
If(plot=1,BarsSinceNth,signal)

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


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




--- In equismetastock@xxxxxxxxxxxxxxx, Chaloke Sambandaraksa 
<chaloke@xxxx> wrote:
> 
> Hi Friends,
> I want to find Bars Since 2nd Last Occurence.
> For example, BarsSince(Cross(RSI(14),30)) returns number
> of Bars since the last time RSI(14) crosses 30 up.
> How can I find number of Bars since RSI(14) crosses 30 up
> since the previous time? and perhaps since the 3rd and 4th times?
> Thanks
> Chaloke





------------------------ 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/