[TS懶人包] [保險服務]

2010年3月16日 星期二

跳空對日內行情的影響

最近的盤有點悶…剛在吃飯時想到,是不是因為沒跳空…所以才沒什麼行情。也就因為這樣…所以無聊來作一下計算。當然不是我自己去算…而是交給電腦去算。

首先是有跳空的程式碼:

vars: count(0), highlow(0), flag(0);

if date <> date[1] then
flag = 0;

if time = 900 and (highd(0) < lowd(1) or lowd(0) > highd(1)) then
flag = 1;

if time = 1330 and flag = 1 then begin
count = count + 1;
highlow = highlow + highd(0) - lowd(0);
end;

if lastbaronchart then
print(count, highlow, highlow/count);



主要就是以九點時的高低點和前一天的高低點作比較。如果低點比昨天高點高或是高點比昨天低點低…那就當成是有跳空。

再來是沒有跳空的程式碼:

vars: count(0), highlow(0), flag(0);

if date <> date[1] then
flag = 0;

if time = 900 and (highd(0) < highd(1) and lowd(0) > lowd(1)) then
flag = 1;

if time = 1330 and flag = 1 then begin
count = count + 1;
highlow = highlow + highd(0) - lowd(0);
end;

if lastbaronchart then
print(count, highlow, highlow/count);


沒跳空就是九點時的高低點是被包在前一天的高低點內的。

這樣計算出來…得出來的結果是:

623.00 71257.00 114.38
1050.00 114381.00 108.93

有跳空佔了 623 天,高低值為 71257,所以相除後得到 114.38 點。
而沒有跳空佔了 1050 天,高低值為 114381,相除後得到 108.93 點。

嗯…程式計算的結果大概符合我的想法…雖然我本來以為會相差很多的…結果才差了 6 點。

既然這個想法目前沒想到用處…那就先歸到程式教學吧…

想教的是…不過什麼想法都可以測試。只要你能把邏輯定義出來。
再來就是… Print 這個指令真的很重要…三不五時請把它拿出來用一下。

1 則留言:

  1. DK:

    關於這篇code..
    low 跟 high 後面為什麼要加d?
    還有就是..
    lastbaronchart 這什麼..//

    回覆刪除

請留下您的大名…匿名者恕不回應…

Related Posts Plugin for WordPress, Blogger...