Page 1 of 1

Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by sptrader
The subject line says it all, I'm looking to capture the price at a specific time (say 9am) on CL using 800 tick bars... sometimes I get a bar that closes at 8:58 and the next bar closes at 9:02.. BUT there is a price at 9am, how can I capture it ?
I know a GV from a minute chart would work but I'm looking for somthing more elegant than a GV sledge hammer... I thought using intrabarpersist somehow ....

I tried this but no luck..

Code: Select all

vars:intrabarpersist prc(0);

If time = 0900 then begin
Prc = C;
end;

plot1(prc,"price at 9am");

Re: Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by TJ
The subject line says it all, I'm looking to capture the price at a specific time (say 9am) on CL using 800 tick bars... sometimes I get a bar that closes at 8:58 and the next bar closes at 9:02.. BUT there is a price at 9am, how can I capture it ?
I know a GV from a minute chart would work but I'm looking for somthing more elegant than a GV sledge hammer... I thought using intrabarpersist somehow ....
I tried this but no luck..

Code: Select all

vars:intrabarpersist prc(0);
If time = 0900 then begin
Prc = C;
end;
plot1(prc,"price at 9am");
You have almost got it... ;-)>

Give this a try:

Code: Select all

vars: intrabarpersist prc( 0 );

If time < 0900 then Prc = C;

plot1( prc, "price at 9am" );

Re: Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by sptrader
TJ- That's a huge improvement but how do I erase everything before the "captured" 9am price ?? - see chart attached...
(I'm trying to create an opening range indicator fo tick bars)..

Re: Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by sptrader
I think I have it with this slight change--

Plot it as "point" style .... I was ploting as a line before, can't believe I did that..

Thanks TJ !!

Re: Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by TJ
a few additional points:

1. intrabarpersist works only in real time.

2. you should use time_s for non-minute charts.

3. you can use a condition to limit the plots before 9:00.

eg.

Code: Select all

vars:intrabarpersist prc( 0 );

If time_s < 090000 then Prc = C;

if time_s >= 90000 then
plot1( prc, "price at 9am" );

Re: Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by TJ
ps. my logic actually gives you the tick before 0900.

Re: Need price at a specific time- using tick bars

Posted: 08 Sep 2013
by sptrader
ps. my logic actually gives you the tick before 0900.
***********************************************

I changed it to <= 0900 and it's very close... If I have a 9:00am tick bar, it's perfect, without a 9am bar, it's very close.. .

Thanks again TJ..