Thanks - I didn't initially appreciate how well structured the nested parentheses are in these formulae. Vey nicely done within the language set, and this definitely gives the correct answer.
This is a great tehcnique to know!
|
Bruce - thanks, these formulae helped in answering a similar question, In my case, I was simply looking to determine whether a crossover had happened within a certain number of days,
For usiong this approach in a column value of a watch list, where the value is the number of days since the last crossover, there may be an error in this approach. I haven't proven this yet, but let me give a hypothetical example.
Suppose the crossover occurred more than one time in the period covered by the formula - say, for the 20 bar stochastic above. If a crossover had occurred 5 days ago and 12 days ago, I believe the result would be 17, the sum of the two, not 5, which is the desired answer.
I haven't thought about this enough to come up with a solution (for that matter, like I said, I haven't even proven it's a problem, but I'm pretty confident it is). Not sure if this can be done without an if/else or other conditional structure to bail out once the test condition has been met the first time, but I'll respond if I come up with something worthwhile.
|