PureBytes Links
Trading Reference Links
|
Hello All,
I have been using MetaStock v6.5 for about four months and this is my
first post to the list. I'd like to offer a little something which might
be of use to someone and hopefully get a question answered. I have
developed the following custom indicator for the number of periods
loaded in a displayed chart:
NumPeriods:= Sum(1, LastValue(Cum(1)));
NumPeriods {Returns a single point at the right-hand edge of chart
with the number of periods loaded in the chart.}
It is interesting that I had to use three MetaStock language functions
to arrive at a constant which must be embedded somewhere within
MetaStock when a chart is loaded. It would be nice if Equis had provided
a function which would give the number of loaded periods directly.
But I digress, my objective is to develop a custom indicator which gives
the "Buy and Hold" performance of a security, something which is useful
to compare with the results from System testing. Such an indicator
requires the first loaded value of the closing price. I attempted,
unsuccessfully, to use the above number of periods loaded in the chart
to come up with an expression for the first loaded CLOSE:
NumPeriods:= Sum(1,LastValue(Cum(1)));
1stCLOSE:= REF(CLOSE, - (NumPeriods - 1));
1stCLOSE {Returns a single point with the value of the CLOSE for
the first period loaded in the chart.}
This custom indicator for the first loaded CLOSE did not work because
the MetaStock language will not accept a nonconstant value for the
periods portion of the REF function. By manually inserting the number of
loaded periods I verified that the above relation is correct but I want
an indicator which automatically inserts the correct periods loaded.
Once the first loaded CLOSE is available it is a trivial extention to
define the "Buy and Hold" performance in an indicator.
Does anyone know how to reference the first loaded value of anything in
MetaStock?
Charles Kalb
chaskalb@xxxxxxx
|