台灣50專屬多空指標

By | 2019-08-12

很久之前有跟大家分享過一個台灣50的多空指標,那就是計算前面十檔台灣50指數成份股有多少檔站在月線之上。上週五颱風假在假閒閒沒事,想說要不要乾脆把50檔成份股都納進來算,結果50檔裡有多少檔站在月線之上這樣的數據,對照台灣50的走勢,確實是有一定的參考價值,所以我想就直接跟大家分享腳本,讓大家不必辛苦的敲半天,然後也可以根據這樣的想法,透過計算有多少檔成份股RSI在50以上之類的數據,創造自己專屬的多空指標。

有不少朋友喜歡看多大盤時買0050,看壞大盤後市時買00632R,所以需要一個研究台灣50後市的多空依據,以下的腳本是用來計算台灣50裡的50檔成份股,有多少檔站在月線之上。

腳本

value1=GetSymbolField("1101.tw","收盤價");
value2=GetSymbolField("1102.tw","收盤價");
value3=GetSymbolField("1216.tw","收盤價");
value4=GetSymbolField("1301.tw","收盤價");
value5=GetSymbolField("1303.tw","收盤價");
value6=GetSymbolField("1326.tw","收盤價");
value7=GetSymbolField("1402.tw","收盤價");
value8=GetSymbolField("2002.tw","收盤價");
value9=GetSymbolField("2105.tw","收盤價");
value10=GetSymbolField("2207.tw","收盤價");
value11=GetSymbolField("2301.tw","收盤價");
value12=GetSymbolField("2303.tw","收盤價");
value13=GetSymbolField("2308.tw","收盤價");
value14=GetSymbolField("2317.tw","收盤價");
value15=GetSymbolField("2327.tw","收盤價");
value16=GetSymbolField("2330.tw","收盤價");
value17=GetSymbolField("2357.tw","收盤價");
value18=GetSymbolField("2382.tw","收盤價");
value19=GetSymbolField("2395.tw","收盤價");
value20=GetSymbolField("2408.tw","收盤價");
value21=GetSymbolField("2409.tw","收盤價");
value22=GetSymbolField("2412.tw","收盤價");
value23=GetSymbolField("2454.tw","收盤價");
value24=GetSymbolField("2474.tw","收盤價");
value25=GetSymbolField("2633.tw","收盤價");
value26=GetSymbolField("2801.tw","收盤價");
value27=GetSymbolField("2880.tw","收盤價");
value28=GetSymbolField("2881.tw","收盤價");
value29=GetSymbolField("2882.tw","收盤價");
value30=GetSymbolField("2883.tw","收盤價");
value31=GetSymbolField("2884.tw","收盤價");
value32=GetSymbolField("2885.tw","收盤價");
value33=GetSymbolField("2886.tw","收盤價");
value34=GetSymbolField("2887.tw","收盤價");
value35=GetSymbolField("2890.tw","收盤價");
value36=GetSymbolField("2891.tw","收盤價");
value37=GetSymbolField("2892.tw","收盤價");
value38=GetSymbolField("2912.tw","收盤價");
value39=GetSymbolField("3008.tw","收盤價");
value40=GetSymbolField("3045.tw","收盤價");
value41=GetSymbolField("3711.tw","收盤價");
value42=GetSymbolField("4904.tw","收盤價");
value43=GetSymbolField("4938.tw","收盤價");
value44=GetSymbolField("5871.tw","收盤價");
value45=GetSymbolField("5876.tw","收盤價");
value46=GetSymbolField("5880.tw","收盤價");
value47=GetSymbolField("6505.tw","收盤價");
value48=GetSymbolField("9904.tw","收盤價");
value49=GetSymbolField("9910.tw","收盤價");
value50=GetSymbolField("2823.tw","收盤價");

variable:count(0);
input:period(20);
count=0;
if value1>average(value1,period) then count=count+1;
if value2>average(value2,period) then count=count+1;
if value3>average(value3,period) then count=count+1;
if value4>average(value4,period) then count=count+1;
if value5>average(value5,period) then count=count+1;
if value6>average(value6,period) then count=count+1;
if value7>average(value7,period) then count=count+1;
if value8>average(value8,period) then count=count+1;
if value9>average(value9,period) then count=count+1;
if value10>average(value10,period) then count=count+1;
if value11>average(value11,period) then count=count+1;
if value12>average(value12,period) then count=count+1;
if value13>average(value13,period) then count=count+1;
if value14>average(value14,period) then count=count+1;
if value15>average(value15,period) then count=count+1;
if value16>average(value16,period) then count=count+1;
if value17>average(value17,period) then count=count+1;
if value18>average(value18,period) then count=count+1;
if value19>average(value19,period) then count=count+1;
if value20>average(value20,period) then count=count+1;
if value21>average(value21,period) then count=count+1;
if value22>average(value22,period) then count=count+1;
if value23>average(value23,period) then count=count+1;
if value24>average(value24,period) then count=count+1;
if value25>average(value25,period) then count=count+1;
if value26>average(value26,period) then count=count+1;
if value27>average(value27,period) then count=count+1;
if value28>average(value28,period) then count=count+1;
if value29>average(value29,period) then count=count+1;
if value30>average(value30,period) then count=count+1;
if value31>average(value31,period) then count=count+1;
if value32>average(value32,period) then count=count+1;
if value33>average(value33,period) then count=count+1;
if value34>average(value34,period) then count=count+1;
if value35>average(value35,period) then count=count+1;
if value36>average(value36,period) then count=count+1;
if value37>average(value37,period) then count=count+1;
if value38>average(value38,period) then count=count+1;
if value39>average(value39,period) then count=count+1;
if value40>average(value40,period) then count=count+1;
if value41>average(value41,period) then count=count+1;
if value42>average(value42,period) then count=count+1;
if value43>average(value43,period) then count=count+1;
if value44>average(value44,period) then count=count+1;
if value45>average(value45,period) then count=count+1;
if value46>average(value46,period) then count=count+1;
if value47>average(value47,period) then count=count+1;
if value48>average(value48,period) then count=count+1;
if value49>average(value49,period) then count=count+1;
if value50>average(value50,period) then count=count+1;

value51=count-25;

plot1(value51,"台灣50多頭指數");


用這個腳本可以畫出下面這張圖

觀察這樣的對照圖,我們有丝個結論

一,當這個指標在20以上快速下跌時,往往是多頭市場的結束

二,當這個指標在-20左右快速往上走時,往往是多頭市場的開始

三,當這個指標穩定的維持紅柱體時,代表大多數的成份股是站在月線之上,屬於多頭架構

四,當這個指標穩定維持在0以下時,代表大多數的成份股站在月線之下,屬於空頭架構

五,當指標與台灣50背離時,往往是反轉訊號。

下圖則是這個指標與台灣50一分鐘的對照圖,這裡代表的是20分鐘移動平均線,如果大家覺得應該調整參數,請直接修改。

 

以上大致是這個指標的作法與應用,我做的是苦工,目的是讓大家不用自己敲50檔成份股的股票代碼,剩下的就讓大家自由發揮了。

 

 

 

 

回應