# closed(1) of data2 does not work, STD error

Questions about MultiCharts and user contributed studies.
Posts: 113
Joined: 28 Apr 2008
Has thanked: 20 times
Been thanked: 1 time

### closed(1) of data2 does not work, STD error

Hallo,

closed(1) of data2 is generating STD error,

can somebody test it, maybe it is only problem of my data ?!

ciao

TJ
Posts: 7548
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1009 times
Been thanked: 2165 times
can you copy and paste the whole error message?
or a screen shot?

do you mean

close(1) of data2

closed(1) of data2

Posts: 113
Joined: 28 Apr 2008
Has thanked: 20 times
Been thanked: 1 time
I mean:

closed(1) of data2;

obtain close price of previous day of data stream number 2 on intraday basis;

or KISS: so you get (normaly) close price of yesterday of second data on you chart.

Full error text:
"Message: Error in study "My Test":STD exception : invalid argument"

ciao

Posts: 113
Joined: 28 Apr 2008
Has thanked: 20 times
Been thanked: 1 time
DEfinition of closed:

CloseD (Series Function)

The CloseD function allows you to reference the daily Close of previous days in an intraday chart (minute or tick-based) or a daily chart.

CloseD is a function in a family of functions that allows historical daily, weekly, monthly, and yearly references in intraday charts. See also: HighD, LowD, OpenD, CloseW, CloseM, and CloseY.

Usage
CloseD(PeriodsAgo)

Returns (Double)
A numeric value for the current bar. If the PeriodsAgo parameter is out of range (> 50), or there is not enough data, the function will return –1.

Parameters
PeriodsAgo
A numeric value. The number of days/periods back to reference a previous day’s closing price. (50 days back maximum) (0 = Today’s current Close)

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

The value for the PeriodsAgo input parameter should always be a positive whole number greater than or equal to 0, but less than 51. Setting PeriodsAgo to 0 equals today’s current Close.

Example
Assigns the Close of the previous day on an intraday chart to Value1, then plots Value1:

Value1 = CloseD(1);

Plot1(Value1, "PrevClose");

TJ
Posts: 7548
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1009 times
Been thanked: 2165 times
it works in my MC.

Version 5.0 Beta 5 (Build 2199)
Last edited by TJ on 18 May 2009, edited 2 times in total.