Constants
eClose is not a variable in the sense that it holds a close price for any
stock. eClose is a constant to identify in some functions which piece
of information you are accessing. All items in our ESPL
language that are constants begin with the letter 'e'. A typical
function that uses eClose is the GetData function, whose documentation is
reproduced here.
function GetData(field: integer [, flag:
boolean]): variant;
Description: Returns for the last retrieved data base record a value
for the named field.
Parameters: Field is one of the following predefined constants:
eAsk
eAskSize eBeta
eBid
eBidSize eClose
eDividend eDown
eEarnings eEPS
eEstEPS eExchange
eExpiration eHigh
eInterest eIssuer
eLast
eLow eMarket
eMarketID
eMarketName eName
eNet eOpen
eScaleFactor ePERatio
eSettled eStrike
eSymbol eTickTime
eTickVolume eTotal
eUnchanged eUp
eVolume eYearlyHigh
eYearlyHighDate eYearlyLow eYearlyLowDate
eYesterday
eYield
For Open, Last, High, Low, Net, Bid and Ask the default is to return a
display value, such as 10516 for bonds. By including a flag of True
after the constant field, a calculation value will be returned, such as 105.50
instead of 10516 for bonds. The flag default is False.
If flag is True, eTickTime is calculated in number of seconds since
midnight. If flag is false, eTickTime returns a tick time string
showing hours, minutes and seconds.
If flag is True, eExpiration, eYearlyHighDate and eYearlyLowDate
return the number of days since January 1st, 1970. If flag is
false, they return a date string in the format of ‘mm-dd-yy’.
eMarketName and eSymbol return strings.
eMarketID returns a character for use in creating custom quote page files.
Example:
var price: real;
begin
if Find(eFuture,'US0Z') then begin
price:=GetData(eClose,True);
end;
end;
In this example, we use Find to locate and decode the database record for the
US0Z symbol. The Close price is obtained from the record using the
GetData function. The eCLose constant identifies the field to
return. Just to be clear, eClose is a constant not a variable.
eClose happens to have a constant value of 103 which can be discovered with
writeln(eClose);. But that piece of information is useless to
you. GetData(103,True) is the same as
GetDate(eClose,True) but the latter is more readily readable than
the first.
GetData can be used to obtain today's high, low, volume information by
changing the field constant parameter. GetData can obtain
yesterday's close value by using the eYesterday constant: price:=GetData(eYesterday,True);.
However, the high, low and volume for yesterday are not stored in the database
record that is accessed by the GetData function, so another approach must be
taken.
To get data for any prior chart bar, such as yesterday's, or several days
ago, you would use the Chart function to load the chart, and then reference any
bar with an index. The last bar on the chart has an index that is
stored in the global variable called BarEnd. So yesterday's bar will
have an index of BarEnd-1;. Each of the bar values is in an array
with the name of the value, such as Last, High, Low, and Volume.
Example:
begin
Chart('SP9Z');
writeln('Last = ',Last(BarEnd-1));
writeln('High = ',High(BarEnd-1));
writeln('Low = ',Low(BarEnd-1));
writeln('Volume = ',Volume(BarEnd-1));
end;
|