DHigh

Category: Constants

DHigh is a function in ProBuilder language used to retrieve the highest price of a specific bar within a given number of days from the current trading day. This function is particularly useful for analyzing price trends over a specified period by identifying the maximum price reached each day.

Syntax:

DHigh(N)

Where N represents the number of bars (days) back from the current bar. N is zero-indexed, meaning N=0 refers to the current bar, N=1 refers to one bar ago, and so on.

Example:

// Calculate the highest high of the last 10 bars
Newhighest = 0
FOR a = 0 TO 9 DO
    IF DHigh(a) > Newhighest THEN
        Newhighest = DHigh(a)
    ENDIF
NEXT
RETURN Newhighest

This example initializes a variable Newhighest to zero and iterates through the last 10 bars (from the current bar to 9 bars ago). During each iteration, it compares the high of each bar with Newhighest. If a higher value is found, it updates Newhighest with that value. Finally, it returns the highest value found over the specified period.

  • The function is useful for traders and analysts to determine the highest price level over a specific timeframe, aiding in decision-making processes such as setting stop-loss orders or identifying potential resistance levels.
  • It is important to ensure that the index N does not exceed the available data range to avoid runtime errors.

This function is a fundamental tool in technical analysis within the ProBuilder environment, helping users to programmatically assess and utilize historical price data in their trading strategies.

Related Instructions:

  • DClose constants
  • DLow constants
  • DOpen constants
  • Logo Logo
    Loading...