logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
dieselpr  
#1 Posted : Tuesday, June 13, 2006 4:13:13 PM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Does anyone know if you can use Roy-Event Counter to count intraday bars? If you wanted the counter to reset every 30 bars regardless of the time frame. I was thinking I could use some light code like this to solve the problem but it doesn't work out correctly. Time:= If(Hour()>Ref(Hour(),-1),1, If(Hour()=0,1, 0)); {1hr-Weekly Trading session} a:=Time>=1; {signal to count} b:=Time=31; {signal to reset} ============= Event Counter ============= This counter can may be used to count bars or events. The 'A' and 'B' variables are the count and reset signals. ---8<--------------------------- {Event Counter} {2004 Roy Larsen, rlarsen@man.quik.co.nz} D:=Input("Event Counter, 0=Leading Edge, 1=Bars True",0,1,0); A:=DayOfMonth()=13; {count this signal} B:=Month()=12; {reset signal} I:=Cum(A+B>-1)=1; {count and reset valid} X:=Cum(A); {bar count} A:=If(D,A,A*Alert(A=0,2)); F:=BarsSince(I+A)<BarsSince(I+B); {window} Z:=X-ValueWhen(1,I+(F=0),X); Z; ---8<---------------------------
wabbit  
#2 Posted : Tuesday, June 13, 2006 4:19:16 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Dieselpr, Use mod(cum(1),30)=0 as the reset criteria. wabbit :D
dieselpr  
#3 Posted : Tuesday, June 13, 2006 4:26:08 PM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Thanks Wabbit that solved the problem you can mark this post as resolved please. Thanks Again
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.