How can get the first value of a bar?

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
templ
Posts: 86
Joined: 19 Nov 2006
Has thanked: 2 times
Been thanked: 2 times

How can get the first value of a bar?

Postby templ » 30 Nov 2006

Hello,
I study this sources
https://www.TS.com/support/bo ... _Guide.pdf
http://www.tssupport.com/support/tutorials/
but cant get an answer and dont know where to ask!

How can get the first value of a bar? I have two inputs
inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 ) ;
This dont work: startValue1 = DataSeries1[1];

Chris
Posts: 150
Joined: 17 Nov 2005

Re: easy language, sorry few simple questions

Postby Chris » 30 Nov 2006

Hello,
I study this sources
https://www.TS.com/support/bo ... _Guide.pdf
http://www.tssupport.com/support/tutorials/
but cant get an answer and dont know where to ask!

How can get the first value of a bar? I have two inputs
inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 ) ;
This dont work: startValue1 = DataSeries1[1];
I don't completely understand what you are trying to do, but the first value of a bar is the open.

So if you have defined the variable "startvalue1" then

Code: Select all

startValue1 = Open;
should give you the first value of every bar.

Use

Code: Select all

Plot1(startValue1);
to verify that visualy on a chart.

Chris

templ
Posts: 86
Joined: 19 Nov 2006
Has thanked: 2 times
Been thanked: 2 times

Postby templ » 30 Nov 2006

Thanks for the reply, sorry for my bad explanation!

I need the absolute first bar of a dataseries.
With my example I get the closes of two symbols (every close of each BAR)

Code: Select all

inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 ) ;
But I need now to know how can I grab the values of the first bar.
Can you help, would be very nice!

In easyLanguage-refguide I found only this:
For example, the following expression is referencing the closing price from 2 bars ago:

Code: Select all

Close[2]
But how to grab the first bar and not only a few bars ago?

Chris
Posts: 150
Joined: 17 Nov 2005

Postby Chris » 01 Dec 2006

This should help:

Code: Select all


Variables:
FirstBarOpen (0),
FirstBarHigh (0),
FirstBarLow (0),
FirstBarClose (0);


If CurrentBar = 1 then begin

FirstBarOpen = Open;
FirstBarHigh = High;
FirstBarLow = Low;
FirstBarClose = Close;

end;
This will store the Open, High, Low and Close of the very first bar on your chart in the four variables.

Chris

templ
Posts: 86
Joined: 19 Nov 2006
Has thanked: 2 times
Been thanked: 2 times

Postby templ » 01 Dec 2006

Ok, there is no direct way to the first Bar! Thanks for explanation & code!


Return to “User Contributed Studies and Indicator Library”