期指當沖交易領先指標的設定方法

By | 2020-03-13

連續兩篇都在介紹由權值股的表現,來總合成一個期指多空方向的領先指標,為什麼國際金融情勢地動山搖,而我一直聚焦在介紹期指當沖的領先指標呢? 原因是我也不知道隔天醒來市場會往上噴還是往下掉,但盤中至少這些外在的變數可以直接從盤面的反映而得知,所以我才會聚焦在介紹期指當沖的領先指標上。

繼前兩篇製定指標的方法之後,今天跟大家介紹利用兩個陣列來輸入領先指標成份股及其在計數器上的權重,然後算出加權後的領先指標,以下是程式樣本

給不同成份股不同的權值

array:T50[50](0),W50[50](0),S50[50](0);
t50[1]=GetSymbolField("1101.tw","close");
t50[2]=GetSymbolField("1102.tw","close");
t50[3]=GetSymbolField("1216.tw","close");
t50[4]=GetSymbolField("1301.tw","close");
t50[5]=GetSymbolField("1303.tw","close");
t50[6]=GetSymbolField("1326.tw","close");
t50[7]=GetSymbolField("1402.tw","close");
t50[8]=GetSymbolField("2002.tw","close");
t50[9]=GetSymbolField("2105.tw","close");
t50[10]=GetSymbolField("2227.tw","close");
t50[11]=GetSymbolField("2301.tw","close");
t50[12]=GetSymbolField("2303.tw","close");
t50[13]=GetSymbolField("2308.tw","close");
t50[14]=GetSymbolField("2317.tw","close");
t50[15]=GetSymbolField("2327.tw","close"); 
t50[16]=GetSymbolField("2330.tw","close");
t50[17]=GetSymbolField("2357.tw","close");
t50[18]=GetSymbolField("2382.tw","close");
t50[19]=GetSymbolField("2395.tw","close");
t50[20]=GetSymbolField("2408.tw","close");
t50[21]=GetSymbolField("2412.tw","close");
t50[22]=GetSymbolField("2454.tw","close");
t50[23]=GetSymbolField("2474.tw","close");
t50[24]=GetSymbolField("2633.tw","close");
t50[25]=GetSymbolField("2801.tw","close");
t50[26]=GetSymbolField("2823.tw","close");
t50[27]=GetSymbolField("2880.tw","close");
t50[28]=GetSymbolField("2881.tw","close");
t50[29]=GetSymbolField("2882.tw","close");
t50[30]=GetSymbolField("2883.tw","close");
t50[31]=GetSymbolField("2884.tw","close");
t50[32]=GetSymbolField("2885.tw","close");
t50[33]=GetSymbolField("2886.tw","close");
t50[34]=GetSymbolField("2887.tw","close");
t50[35]=GetSymbolField("2888.tw","close");
t50[36]=GetSymbolField("2890.tw","close");
t50[37]=GetSymbolField("2891.tw","close");
t50[38]=GetSymbolField("2892.tw","close");
t50[39]=GetSymbolField("2912.tw","close");
t50[40]=GetSymbolField("3008.tw","close");
t50[41]=GetSymbolField("3045.tw","close");
t50[42]=GetSymbolField("3711.tw","close");
t50[43]=GetSymbolField("4904.tw","close");
t50[44]=GetSymbolField("4938.tw","close");
t50[45]=GetSymbolField("5871.tw","close");
t50[46]=GetSymbolField("5876.tw","close");
t50[47]=GetSymbolField("5880.tw","close");
t50[48]=GetSymbolField("6505.tw","close");
t50[49]=GetSymbolField("9904.tw","close");
t50[50]=GetSymbolField("9910.tw","close");

W50[1]=1;
W50[2]=1;
W50[3]=1;
W50[4]=1;
W50[5]=1;
W50[6]=1;
W50[7]=1;
W50[8]=1;
W50[9]=1;
W50[10]=1;
W50[11]=1;
W50[12]=1;
W50[13]=1;
W50[14]=2;
W50[15]=1;
W50[16]=3;
W50[17]=1;
W50[18]=1;
W50[19]=1;
W50[20]=1;
W50[21]=1;
W50[22]=1;
W50[23]=1;
W50[24]=1;
W50[25]=1;
W50[26]=1;
W50[27]=1;
W50[28]=1;
W50[29]=1;
W50[30]=1;
W50[31]=1;
W50[32]=1;
W50[33]=1;
W50[34]=1;
W50[35]=1;
W50[36]=1;
W50[37]=1;
W50[38]=1;
W50[39]=1;
W50[40]=1;
W50[41]=1;
W50[42]=1;
W50[43]=1;
W50[44]=1;
W50[45]=1;
W50[46]=1;
W50[47]=1;
W50[48]=1;
W50[49]=1;
W50[50]=1;
variable:count(0),i(0);
count=0;
for i=1 to 50
begin
if t50[i]> t50[i][1]
then count=count+W50[i];
end;
value1=average(count,10);
plot1(value1);

這個腳本是用第二個陣列來輸入權重,大家可以自己嚐試看看不同的權重是否各具備領先的效果。

下面是我做的加權領先指標跟加權指數一分鐘線的對照圖

請跟前面兩個指標一起對照著看,看看是否可以掌握加權指數盤中的轉折點

 

回應