Is it safe to use PeakBar/TroughBar in an auto-traded strategy?
Author: tschwei
Creation Date: 2/4/2017 2:46 AM
profile picture


I have a simple question:
There are a couple zigzag strategies that use these PeakBar.Series and TroughBar.Series, and I would like to know if it is really legit/legal/safe to use these in a real (auto) trading strategy?

It seems that the only way to use these data series is to loop backwards over all the bars, but isn't that peaking (which is a no-no).

If you go forward, it seems the returned bars are too far in the past to be useful.

profile picture


Yes. Quoting from PeakBar:

The Peak function never "looks ahead" in time, but always returns the Peak value as it would have been determined as of the specified bar. For this reason, the return value of the Peak function will lag, and report peaks a few bars later than they actually occurred in hindsight. This is intentional, and allows peak/trough detection to be used when back-testing trading systems.