♥ 0 |
hi Pete, I’ve been struggling with this one for some time now. Many times I’m gathering intraday information and want a cross-reference it against daily data in the past.
An example might be I currently have a chart that gives me the highest price by 8:30 today during market open
I want to compare that data to the closing price from yesterday so I can make a percent call them. I found a complex method to do it by trying to grab the price at the closing bell but sometimes if a stock didn’t trade at the closing bell it won’t return that data I was then able to modify it by getting the most recent closing price within a certain time frame before the closing bell but it all seems very sloppy
Anytime I try to reference in aggression period of a day passed on an intraday column it gives me an error. Love any insight you may have
Marked as spam
|
Please log in to post questions.
Show me the code you have built to try to solve this and I might be able to fix it.
Here’s the portion I’m currently using to grab the closing price. The problem is this bandaid solution is this only records stocks who have a tick 1m before the closing bell, or as in my modified solution below, a few hours before closing.
declare lower;
declare zerobase;
input close_to_closing_time = 1300;
input closing_time = 1559;
input open_time = 0930;
def time_until_close = SecondsTillTime(closing_time);
def time_until_close2close = secondstilltime (close_to_closing_time);
def closing_bell = time_until_close == 0;
def after_close_to_closing_time = time_until_close2close =0;
rec closing_price = compoundvalue(1,if closing_bell then close else if before_closing_bell and after_close_to_closing_time then close else closing_price[1],0);
My desire would be to use something like this code, on a 1m column or scan study:
def yesterday_close = close(period = AggregationPeriod.DAY)[1];
Are you using extended hours trade data for this? If so, I don’t see an easy solution. If you are using only regular session trade data, we can check for “new day” and grab the close of the previous 1 min bar.