Beim Übersetzen von Metastock Formeln stoße ich gelegentlich auf die Metastock Funktion LastValue. Eine Investox Funktion die dem Metastock „LastValue“ gleich kommt wäre sicherlich nicht schlecht. ;-)
Die Funktion wird in der Metastock-Hilfe folgender maßen beschrieben:
SYNTAX lastvalue(DATA ARRAY)
FUNCTION This function loads an entire data array with the last calculated value of the specified DATA ARRAY. The result of this function can be used in place of a constant in any function argument.
If DATA ARRAY is undefined (e.g., only 100-days loaded and you request the last value of a 200-day moving average) then the lastvalue function returns zero.
Since this function loads an entire data array with the last value of another array, it allows a formula to look into the future. This is unacceptable for most indicators, but is very beneficial for things like pattern recognition.
EXAMPLE The formula "mov(close,lastvalue(fml("Determine Periods")),s)" calculates a moving average using the number of periods returned by the indicator named "Determine Periods".
Auf die LastValue Funktion bin ich zuletzt beim „Center of Grafity Oscillator“ gestoßen.
x:=Input("number of periods",1,50,10);
pr:=(H+L)/2;
c1:=Cum(1);
num:=Sum(((LastValue(C1+PREV-PREV)+1)-C1)*pr,x);
denom:=Sum(pr,x);
cg:=-num/denom;
cg;
Ref(cg,-1);