Constants/probuilder · probacktest · proorder · proscreener

DHigh

DHigh returns the highest price of a daily bar in ProBuilder. Use DHigh(N) to read the high from N days ago on any timeframe, without switching the chart to daily bars.

Syntax

probuilder
DHigh(N)

N is a non-negative value giving the number of days back. DHigh(0) is the current day, DHigh(1) is the previous trading day, and so on.

How it works

DHigh reads the high of a daily bar even when the chart runs on an intraday timeframe. On a fifteen-minute chart, DHigh(1) returns yesterday's daily high rather than the high of a single fifteen-minute bar.

The argument uses parentheses and counts in trading days. On the current day, DHigh(0) reflects the highest price so far in the session and can rise until the day closes. N must stay within the loaded daily history, otherwise the call errors.

Daily highs are natural resistance references for intraday work. Comparing the current price against DHigh(1) tests whether today has cleared yesterday's high, and looping over several DHigh(a) values finds the highest high across a span of days.

Examples

Example 1, Highest daily high over ten days (Indicator)

probuilder
// Track the highest daily high across the last ten days
newHighest = 0
FOR a = 0 TO 9 DO
  IF DHigh(a) > newHighest THEN
    newHighest = DHigh(a)
  ENDIF
NEXT
RETURN newHighest AS "10-day high"

The loop compares each day's DHigh and keeps the maximum found over the window.

Example 2, Screening for a break of yesterday's high (ProScreener)

probuilder
// Current price above the previous day's daily high
broke = Close > DHigh(1)

SCREENER[broke] (DHigh(1) AS "Prev day high")

The screener returns instruments trading above the prior day's high.

Example 3, Breakout of the prior daily high (ProOrder)

probuilder
DEFPARAM CumulateOrders = false

// Enter when price clears yesterday's daily high
IF Close CROSSES OVER DHigh(1) THEN
  BUY 1 CONTRACT AT MARKET
ENDIF

SET STOP %LOSS 2

The entry triggers as price crosses above DHigh(1), using the previous daily high as a breakout level.

Common errors and gotchas

  • Parentheses, not brackets. DHigh takes its argument in parentheses like DHigh(1). Square brackets are a syntax error.
  • Current day still forming. DHigh(0) can keep rising during the session, so tests against it change as the day develops. Use DHigh(1) for a fixed prior-day level.
  • Needs daily history. A large N requires enough loaded daily data, or the reference errors.
  • DLow, the lowest price of a past daily bar.
  • DOpen, the opening price of a past daily bar.
  • DClose, the closing price of a past daily bar.
  • High, the highest price of the current timeframe's bar.
  • Low, the lowest price of a bar.
  • Close, the closing price of a bar.
  • Range, the high minus low of a bar.
  • CustomClose, the user-selectable price source.