Is there an easy way to get the (previous) end of day close price (without having to loop)?
Size:
Color:
I'm sure you're not talking about something as simple as Close[bar - 1] and the WealthScript Programming Guide > DataSeries > Accessing a Single Value from a DataSeries >
How to: Access a value at a specific bar. There must be some catch that you don't tell about like intraday bar scale, right? So to get the previous end of day close price in a one-liner, check this out:
Intraday | Building blocks of Intraday trading strategies >
Identify the Open price of the day when working with intraday data
Size:
Color:
A one liner to get yesterday's closing value from an intraday chart... assuming within the bar loop:
CODE:
Please log in to see this code.
Note! The intraday chart's close (last trade before 1600) can differ from the official settled close in a Daily chart, a trade which often occurs after 1600. So in the case that you need to use the official daily closing price, you need to access the data from the daily symbol.
Example: Assume you have an intraday 5-minute DataSet called "N100_5" and a daily DataSet called "N100" with the same symbols. Here's how you'd get the official close in the intraday chart:
CODE:
Please log in to see this code.
Size:
Color:
Similar to this question,...How can I get the value for the price close from 1 year ago?
Size:
Color:
You can subtract one year from the current bar's date with
.AddYears(-1) and then convert it to existing bar using
DateTimeToBar.
Load enough bars to highlight 11/29/2018 (as of today):
CODE:
Please log in to see this code.
Size:
Color: