|
在海期上 讀取到的數值不對
月初會有問題
還要修改哪邊
Inputs:
PeriodsAgo(numericsimple),
oPeriodOpen(numericref),
oPeriodHigh(numericref),
oPeriodLow(numericref),
oPeriodClose(numericref) ;
Variables: Count(0) ;
Arrays: arr0[4,500](-1) ; // O/H/L/C
IF (PeriodsAgo > 500 or BarType > 4) Then //Only keep 500 days of records
BEgin
oPeriodOpen = -1 ;
oPeriodHigh = -1 ;
oPeriodLow = -1 ;
oPeriodClose = -1 ;
$OHLCPeriodsAgo_M = -1 ;
ENd
ELSE
BEgin
For Value1 = 1 to SessionCount(0)
begin
If Value1 < SessionCount(0) then
Value2 = Value1 + 1
else
Value2 = 1;
Condition1 = (SessionEndDayMS(Value1) = DayOfMonth(Date[1])) and (Time[1] <= SessionEndTimeMS(Value1))
AND
(SessionStartDayMS(Value2) = DayOfMonth(Date)) and (Time >= SessionStartTimeMS(Value2));
//Condition1 = (Time[1] <= SessionEndTimeMS(Value1)) AND (Time >= SessionStartTimeMS(Value2));
if Condition1 then
begin
Count = Count - 1 ;
if Count <= -1 then Count = 500;
arr0[1,Count] = O ;
arr0[2,Count] = H ;
arr0[3,Count] = L ;
arr0[4,Count] = C ;
end
else
begin
if H > arr0[2,Count] then arr0[2,Count] = H ;
if L < arr0[3,Count] then arr0[3,Count] = L ;
arr0[4,Count] = C[1];
if PeriodsAgo = 0 then arr0[4,Count] = C;
end ;
end;
oPeriodOpen = arr0[1,Mod(Count + PeriodsAgo, 501)] ;
oPeriodHigh = arr0[2,Mod(Count + PeriodsAgo, 501)] ;
oPeriodLow = arr0[3,Mod(Count + PeriodsAgo, 501)] ;
oPeriodClose = arr0[4,Mod(Count + PeriodsAgo, 501)] ;
$OHLCPeriodsAgo_M = 1 ;
ENd;
IF False THEN Value1 = $OHLCPeriodsAgo_M[1] ;
__________
inputs: PeriodsAgo( numericsimple ) ;
variables: var1(0), var2(0), var3(0), var4(0) ;
Value1 = $OHLCPeriodsAgo_M( PeriodsAgo, var1, var2, var3, var4 ) ;
$Closem = var4 ;
|
|