Using Sum or SumSince

Let's say there's a buy rule like this:
BuyRule1 = C==HHV(C, 75);
Now, what I'd like to do is get a result ONLY if the condition (highest close of the prior 75 bars) has not occurred more than once before in the prior 6 months(135 bars). In other words, if today the condition is valid, it won't trigger a buy if the condition also happened 2 or more times within the previous 135 bars. Now, I'm not experienced, but in researching this site and the web, I discovered 2 examples of what I thought might work, which is posted below. I debugged them in my file and it passed the syntax test. I'd appreciate if anyone can advise if either method accomplishes what I'm looking for or if you recommend a better alternative. Thanks.
BuyRule13 = Sum((HHV(C,75)),135)<=2;
BuyRule14 = SumSince(Ref(HHV(C,75),-135),HHV(C,75)<=2);

Please use code tags!

BuyRule1 = C==HHV(C, 75);
BuyRule2 = BuyRule1 AND Ref(Sum(BuyRule1,135),-1) < 2;
Buy = BuyRule2;

So above lines say that it would trigger Buy if BuyRule1 is TRUE and if BuyRule1 did occur just one or zero time before (within past 135 bars before "current" bar).

Thanks. Much appreciated!

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.