在下嘗試 從2000年到今天為止, 所有的結算日, 寫一指標, 在日K線上標出來,
結算日的函數是從 multicharts官網下載, 異常結算日(遇颱風或春節長假等)有修正.
結果全部正常, 唯有 2010年6月17日沒有標出來, 請問 bug 在那裡? 謝謝!
函數名稱: _closedate 程式碼如下:
---------------------------------------------------------
var: pMon("");
var: pVar1(0);
pMon = MidStr(NumToStr(date,0),1,IFF(date < 1000101,4,5));
VALUE1 = StrToNum(pMon + "01");
VALUE2 = 3-DayOfWeek(VALUE1);
if VALUE2 < 0 then begin
VALUE2 = VALUE2 + 7;
end;
_CloseDate = StrToNum(pMon)*100 + (VALUE2 + 15);
pVar1 = StrToNum(pMon)*100 + (VALUE2 + 15);
switch pVar1 begin
case 990217:
_CloseDate = 990220;
case 1021016:
_CloseDate = 1021017;
case 1030115:
_CloseDate = 1030116;
case 1030521:
_CloseDate = 1030522;
case 1030618:
_CloseDate = 1030620;
case 1030917:
_CloseDate = 1030918;
case 1031015:
_CloseDate = 1031016;
case 1040121:
_CloseDate = 1040127;
case 1040721:
_CloseDate = 1040722;
case 1070221:
_CloseDate = 1070226;
case 1100217:
_CloseDate = 1100222;
default:
_CloseDate = pVar1;
end; -------------------------------------------------------
指標程式碼:
-------------------------------------------------------
var:NumberOfText(0);
if date= _closedate then begin
ARW_new(date, time, low, false);
NumberOfText=NumberOfText+1;
arw_setstyle(NumberOfText,14);
arw_setsize(NumberOfText,20);
arw_setcolor(NumberOfText,yellow);
arw_settextbgcolor(NumberOfText,Blue);
arw_settextcolor(NumberOfText,White);
arw_settext(NumberOfText, MidStr(NumToStr(_closedate,0),2,6));
end;
----------------------------------------------------------
|