Discussions
»
Product and Service Development
»
Formula Assistance
»
MSTT-Event Counter Question for Intraday Bars [RESOLVED]
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<---------------------------
|
|
|
|
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
|
|
|
|
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)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
MSTT-Event Counter Question for Intraday Bars [RESOLVED]
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.