Metastock Exploration

#1
I am trying to write an Exploration for Metastock but got stuck at one point.
Any help in this regard will be appreciated.
My observation: When a stock price dips it tries to find support at one of the previous LOWS.This LOW may be the first instance or second or nth instance when todays close CROSSES above any of the lows. (i.e.nth instance for which Today's CLOSE - Any LOW > 0

My objective: List all LOW prices lower than today's CLOSE and find highest among them, then 2nd highest then 3rd highest among them and so on.

My attempt: ValueWhen(N, Cross(REF(CLOSE,0)) - X) ,0), LOW) N is replaced by 1 for 1st instance, 2 for 2nd instance and so on.
The problem is I want variable X to range over all the LOWS loaded in the chart. It is not possible to replace X with REF(L,-1), then REF(L,-2) and so endlessly.
Can anyone help me in this regard.
 

oxusmorouz

Well-Known Member
#2
Hi Soundrex,
You might want to make use of the zig zag function to identify lows and highs...
Most indicators I've seen (including chart pattern recognition) use this function to identify breakouts...