Log in to see Cloud of Tags

Wealth-Lab Wiki

Syntax

public static Peak Series(DataSeries source, double reversalAmount, WealthLab.Indicators.PeakTroughMode mode)
public static double Value(int bar, DataSeries source, double reversalAmount, WealthLab.Indicators.PeakTroughMode mode)

Parameter Description

source The source DataSeries
reversalAmount How much of a percentage/point (see mode) decline is required to trigger a new Peak
mode WealthLab.Indicators.PeakTroughMode mode
public const WealthLab.Indicators.PeakTroughMode Value = 0
public const WealthLab.Indicators.PeakTroughMode Percent = 1

Description

Returns the value of the last Peak that was identified for the specified Price Series as of the specified Bar. The Reversal parameter determines how much of a percentage (default) or point decline is required to trigger a new Peak. It typically requires a few bars of downward price movement to reach the Reversal level and qualify a new Peak. 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.

Interpretation

  • Peaks/Troughs of highs and lows are often used as support and resistance levels. These points have historical significance because they have proven to be important levels of price reversal.
  • Peaks and troughs are a convenient way of detecting chart patterns. For example, one aspect of a Head & Shoulders Top is a series of 3 Peaks, the second higher than the outer two.

Remarks

  • Calculating peaks/troughs based on percentage moves is not allowed on DataSeries that contains negative or zero values. For these data series you must use PeakTroughMode.Value to base the reversal amount on a point value.

Calculation

Peaks are detected by looking for a percentage (default) or point reversal in the DataSeries greater than or equal to the reversal amount specified in the Reversal parameter. For example, if you specify a reversal value of 10, and prices make a new high of $100, a peak will be triggered at that bar as soon as prices move down to $90. The move down to $90 may take several bars. During these bars the Peak function will not return $100, but will instead return the value of the previous peak. This is because you would not have known that that $100 was an actual peak yet because the reversal level has not been met. The new Peak value of $100 is returned only after prices have reached the $90 level, the reversal level.

Example

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Draw the level of 7% Peaks on the chart PlotSeries( PricePane, Peak.Series( High, 7, PeakTroughMode.Percent ), Color.Red, LineStyle.Dots, 3 ); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.