Error

 Previous Topic Next Topic
 hacker13 #1 Posted : Thursday, December 26, 2013 5:07:04 PM(UTC) Rank: NewbieGroups: Registered, Registered UsersJoined: 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")=0count:= if(prev=0, if(start, 1, 0), if(stop, 0, prev))countSo 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
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 oztrader #2 Posted : Thursday, December 26, 2013 6:31:16 PM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, Unverified UsersJoined: 7/12/2007(UTC)Posts: 134Location: 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 : Friday, December 27, 2013 12:17:17 PM(UTC) Rank: NewbieGroups: Registered, Registered UsersJoined: 12/26/2013(UTC)Posts: 2 Dr OzThanks very much that worked perfectly.
 Users browsing this topic
 Similar Topics +DI>-DI Formula Question (Formula Assistance) by ABcWong 3/22/2014 11:11:30 AM(UTC) Metastock Formula Questions (Formula Assistance) by henry1224 2/3/2012 9:09:01 AM(UTC) formula question on rsi (Formula Assistance) by KERMIT 8/18/2007 8:33:17 PM(UTC) Bollinger Bands + RSI formula question (Formula Assistance) by arnevanveen 1/5/2006 9:14:05 AM(UTC) Peak (or Trough) Formula question. (Formula Assistance) by dklugmann 10/18/2005 11:24:19 AM(UTC) Buy and Hold Formula Question [RESOLVED] (Formula Assistance) by warfield 7/24/2005 5:50:45 PM(UTC) Latching formula question (Formula Assistance) by dieselpr 7/14/2005 1:52:24 AM(UTC)
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.