bar | The bar of detection: function returns true if MTop (WBottom) is detected on bar |
ds | Data Series, e.g. High, Close, etc. |
lookback | The top(bottom) must be a peak(trough) in the lookback period |
pctRetrace | Max percentage difference between the two peaks/troughs |