以下是新增的function名稱和程式內容:
IntraDayMultipier
IntraDayMultipier = 1;
If DataCompression = 1 Then
IntraDayMultipier = SquareRoot( 360 / BarInterval * 60);
HighestValue
input : dArray(Numeric), Length(Numeric);
Variables : ii(0);
Value1 = dArray;
For ii = 2 To Length begin
If Value1 < dArray[ii-1] Then
Value1 = dArray[ii-1];
End;
HighestValue = Value1;
LowestValue
input : dArray(Numeric), Length(Numeric);
Variables : ii(0);
Value1 = dArray;
For ii = 2 To Length begin
If Value1 > dArray[ii-1] Then
Value1 = dArray[ii-1];
End;
LowestValue = Value1;
最後就是 NRTR 這個 function
input:K(Numeric), Max_per(Numeric);
Variables: Trend(Close), Period(0);
Value1 = IntraDayMultipier;
Condition1 = (Close >= Trend);
Condition2 = (Close < Trend);
If ((Close Cross over Trend) or (Close Cross Below Trend)) Then
Period = 0;
If Period < Max_per Then begin
If Condition1 Then begin
Period = Period + 1;
Trend = HighestValue(Close, Period) * (1 - (K / 100) / Value1);
End;
If Condition2 Then begin
Period = Period + 1;
Trend = LowestValue(Close, Period) * (1 + (K / 100) / Value1);
End;
end
Else begin
If Condition1 Then
Trend = HighestValue(Close, Max_per) * (1 - (K / 100) / Value1);
If Condition2 Then
Trend = LowestValue(Close, Max_per) * (1 + (K / 100) / Value1);
End;
NRTR = Trend;
這個函式似乎不少人使用…給大家參考一下。
沒有留言:
張貼留言
請留下您的大名…匿名者恕不回應…