//----- 基本資料設定
for ix = 0 to MAXNUM-1
begin
aix = ix + 1;
if open[ix] > close[ix] then redBlack[aix]="B" else redBlack[aix]="R";
if redBlack[aix] = "B" then
begin
topEntity[aix] = OPEN[ix];
botEntity[aix] = CLOSE[ix];
end else
begin
topEntity[aix] = CLOSE[ix];
botEntity[aix] = OPEN[ix];
end;
lenEntity[aix] = AbsValue(OPEN[ix] - CLOSE[ix]);
lenUpShadow[aix] = HIGH[ix] - topEntity[aix];
lenDnShadow[aix] = botEntity[aix] - LOW[ix];
rateDnShadowEntity[aix] = lenDnShadow[aix] / IFF(lenEntity[aix] = 0, 0.0001, lenEntity[aix]);
rateUpShadowEntity[aix] = lenUpShadow[aix] / IFF(lenEntity[aix] = 0, 0.0001, lenEntity[aix]);
lenHL[aix] = HIGH[ix] - LOW[ix];
mid_HL[aix] = (HIGH[ix] + LOW[ix]) / 2;
mid_Entity[aix] = (OPEN[ix] + CLOSE[ix]) / 2;
if (lenHL[aix]= 0) then begin
rateUpShadowHL[aix] = 0;
rateDnShadowHL[aix] = 0;
rateEntity_HL[aix] = 100;
end else begin
rateUpShadowHL[aix] = lenUpShadow[aix] / lenHL[aix];
rateDnShadowHL[aix] = lenDnShadow[aix] / lenHL[aix];
rateEntity_HL[aix] = lenEntity[aix] / lenHL[aix];
end;
rateHL_Price[aix] = lenHL[aix] / CLOSE[ix]; //高低點整體長度/收盤價
rateEntity_Price[aix] = lenEntity[aix] / CLOSE[ix]; //實體長度/收盤價
//是否為長日?實體>中心價5%且實體>價格區間50%
isLong[aix] = (lenEntity[aix] > mid_HL[aix] * 0.05) and (lenEntity[aix] > lenHL[aix] * 0.5);
//是否為短日,實體長度 <= 收盤*2%
isShort[aix] = lenEntity[aix] <= mid_HL[aix] * 0.02;
isCross[aix] = (rateEntity_HL[aix] <= 0.03); //是否為十字線
end;
//------------------
|
留言列表