OpenD (Function)

image\trumpet2.gif Disclaimer

The OpenDseries function allows you to reference the daily open of a previous day in an intraday chart (minute, second, or tick-based) or a daily chart.  OpenD is one of a family of functions that allows historical references across various data intervals.

Syntax

OpenD(PeriodsAgo)

Returns (Double)

The daily open price from a specified number of days ago.  If there is not enough data, the function will return –1.

Parameters

Name

Type

Description

PeriodsAgo

Numeric

Sets the number of days/periods back to reference a previous day’s open price. (0 = Today’s current high)

Remarks

You must have enough intraday data in the chart in order to look back and reference any previous daily open. For example, if you want to look back at the high of 25 days ago on a 5-minute chart, you must have at least 26 full days of 5-minute bars in the chart.

The value for the PeriodsAgo input parameter should always be a whole number greater than or equal to 0. Setting PeriodsAgo to 0 returns today’s current open.

This function considers the transition between one day and the next to occur at midnight, when the date changes. If you're using a symbol that trades overnight and would prefer to use the end of a session to transition to a new "day," consider using the OpenSession function.

If you're calling this function in a study that will be applied to RadarScreen, be sure to set the "Load additional bars" setting. This setting should be set so as to ensure that it exceeds the number of intra-day bars in the PeriodsAgo. For example, if your code looks back 5 days (that is, PeriodsAgo is set to 5), then at least 6 days of intra-day bars should be loaded using the "Load additional bars" setting. On hourly bars for a symbol that trades 24 hours a day, this would be approximately 144 bars (6 x 24). For more detail on the "Load additional bars" setting, see Customize Study Properties.

Example

In order to place a buy limit order at the open of the previous day you would write:

Buy Next Bar at OpenD(1) Limit;

See Also

LowD, CloseD, HighD, HighW, HighM, and HighY.