Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,838
Thanks: 79 times Was thanked: 148 time(s) in 144 post(s)

Originally Posted by: dimpledbrain hi all, need some quick guide to help on the above, basically where i want to say Line A is above/below Line B for x number of days in a row. Initially i thought of highest high value/ LLV, max, min, but it seems like it is just taking 1 point on Line A to compare with 1 point on Line B Alternatively i could write it repeatedly as follows: mov(c,5,%)>mov(c,25,%) mov(ref(c1),5,%)>mov(ref(c1,5),25,%) mov(ref(c2),5,%)>mov(ref(c2,5),25,%)
mov(ref(c3),5,%)>mov(ref(c3,5),25,%)
and so on.... Any idea how to shorten the above. What is the formula language to use? Scanned through the user manual but couldnt locate it Thank you.
Hi, You might want to see if the Sum function fits your needs in this respect. If you wrap Sum around a conditional statement it will return the number of times that condition was true over X periods. You can also make the Sum a conditional statement by requiring that the result has to equal the X periods value. For example:
Code:X:=4;
Sum(Mov(C,5,E)>Mov(C,25,E),X)=X
You don't have to use a Variable of course, although this can make it easier to Edit the formula for different values, and you could also use it with the Input function to make the indicator more customizable without having to Edit the formula every time. Code:X:=Input("True Periods for Condition",1,999,4);
Sum(Mov(C,5,E)>Mov(C,25,E),X)=X

1 user thanked MS Support for this useful post.

