I often encounter EasyLanguage code in which the quote field Last is used instead of the historical data field Close. The code does not work as intended, because Last and Close are not equivalent reserved words.
First, some background information might help to clarify what quote fields are, and how they differ from historical data fields. Quote fields are sometimes also referred to as “server fields.”
A quote field is an EasyLanguage reserved word that returns “snap-shot” data values for a specific symbol. Examples of such reserved words are Last, InsideBid, InsideAsk, and some fundamental data fields, such as the fields that return various price-to-earnings (P/E) ratios. Quote field values are generally updated two or three times per second; they are not updated on each trade tick. The term “snap-shot” refers to this periodic updating of the data. Historical data fields, like Close, High, and Low, on the other hand, update with every new trade tick.
Quote field values are “real-time” only; no historical values of the data are available. For this reason, quote fields should not be used in backtesting. On an historical bar, a quote field will return the current value. This contrasts with historical reserved words like Close and Volume, which provide historical values on historical bars.
Sometimes, programmers will use the reserved word Last, rather than Close, because they believe that Last returns the last traded price and that Close returns the closing price of the bar. However, when used intrabar, Close returns the last traded price. In fact, because it is updated on every trade tick, rather than periodically like Last, Close is the more accurate representation of the price of the last trade.
Generally its best to use historical data fields, rather than quote fields. This is especially true when you’re backtesting, accumulating values intrabar, or when tick-by-tick access to the most recent trade prices intrabar is needed. In such cases use the historical data field Close, for example, rather than the snap-shot version of the data provided by Last.