Hi Folks...
1) I'm new to thinkscript and wrote the following script (excerpt) to perform some calculations on after hours 'last trade price' and the 'end of day (EOD) closing price'. The code is only executed during the 4 PM to 8PM EST 'after hours' time frame.
2) The code is executed in a Watchlist Custom Column
3) The code to get the last trade price works fine and isn't included. Nor is the calculations code. That's because I'm trying to focus my question only on the code for getting the EOD closing price which works fine for some tickers and not for others. Weird.
4) So here is the code for the Watchlist custom column:
# START
# Use 1 minute time frame
# Include after hours = Yes
declare lower;
input aggregationPeriodMIN = AggregationPeriod.MIN;
input aggregationPeriodDAY = AggregationPeriod.DAY;
# last price and EOD close price
def lastPrice = close(period = aggregationPeriodMIN);
def myDailyClose = close(period = aggregationPeriodDay);
# Plot the daily close
plot theDailyClose = myDailyClose;
#END
5) Here is sample output for some random stock symbols:
6) So my question is... why is the 'Plot' statement displaying 'Not a Number' (NaN) for some stocks and in the other cases it is getting the correct EOD closing price for other stock symbols? This was run on 12/19/23 at 7:45 PM EST.
Thanks
1) I'm new to thinkscript and wrote the following script (excerpt) to perform some calculations on after hours 'last trade price' and the 'end of day (EOD) closing price'. The code is only executed during the 4 PM to 8PM EST 'after hours' time frame.
2) The code is executed in a Watchlist Custom Column
3) The code to get the last trade price works fine and isn't included. Nor is the calculations code. That's because I'm trying to focus my question only on the code for getting the EOD closing price which works fine for some tickers and not for others. Weird.
4) So here is the code for the Watchlist custom column:
# START
# Use 1 minute time frame
# Include after hours = Yes
declare lower;
input aggregationPeriodMIN = AggregationPeriod.MIN;
input aggregationPeriodDAY = AggregationPeriod.DAY;
# last price and EOD close price
def lastPrice = close(period = aggregationPeriodMIN);
def myDailyClose = close(period = aggregationPeriodDay);
# Plot the daily close
plot theDailyClose = myDailyClose;
#END
5) Here is sample output for some random stock symbols:
6) So my question is... why is the 'Plot' statement displaying 'Not a Number' (NaN) for some stocks and in the other cases it is getting the correct EOD closing price for other stock symbols? This was run on 12/19/23 at 7:45 PM EST.
Thanks