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

Notification

Icon
Error

Options
Go to last post Go to first unread
hacker13  
#1 Posted : 11 years ago
hacker13

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/26/2013(UTC)
Posts: 2

How do I write a formula that allows me to count the number of times in a row a condition has passed.
Cum(If(Fml("ROC total system buy")=1,1,0)) this is what I came up with but it does not reset to zero once the condition no longer passes.

I read a post on count but can not get the syntax right to get the formula to work.

Cum(If(Fml("ROC total system buy")=1,1,0)

start:= fml("ROC total system buy")=1

stop:= fml("ROC total system buy")=0

count:= if(prev=0, if(start, 1, 0), if(stop, 0, prev))
count
So what I want in english is a line that moves up one for every time the FML is true, but once it is false the count resets to zero and will not move up again until the FML is true again.

Thanks Mark
oztrader  
#2 Posted : 11 years ago
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Below is an example of one of a number of ways to code what you are chasing.

Buy:=Fml("ROC total system buy");
Event:=Buy;
Count:=Cum(Event);
Reset:=Buy=0 AND Alert(Buy<>0,2);
Counter:=Count-ValueWhen(1,Reset,Count);
Counter

hacker13  
#3 Posted : 11 years ago
hacker13

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/26/2013(UTC)
Posts: 2

Dr Oz
Thanks very much that worked perfectly.


Users browsing this topic
Guest (Hidden)
Similar Topics
+DI>-DI Formula Question (Formula Assistance)
by ABcWong 11 years ago
Metastock Formula Questions (Formula Assistance)
by henry1224 13 years ago
formula question on rsi (Formula Assistance)
by KERMIT 18 years ago
Bollinger Bands + RSI formula question (Formula Assistance)
by arnevanveen 19 years ago
Peak (or Trough) Formula question. (Formula Assistance)
by dklugmann 19 years ago
Buy and Hold Formula Question [RESOLVED] (Formula Assistance)
by warfield 20 years ago
Latching formula question (Formula Assistance)
by dieselpr 20 years ago
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.

information You have 1 unread message(s) in your Inbox.