權值股多頭排列家數指標

By | 2018-01-05

昨天說到我那老大哥有一個觀察,他認為如果當天盤面上前三十檔權值股,大多數是多頭排列,他就作多,反之則不進場,於是我寫了一個自訂指標,用來計算前三十檔權值股,有多少檔是多頭排列。拿這個指標來決定今天的多空方向,我個人的觀察是,還真是有些兒的道理。

我寫的指標腳本如下,大家請直接複製貼上即可,不過如果權值股有變的時候記得要換一下

value1=GetSymbolField("2330.tw","收盤價");
value2=GetSymbolField("2317.tw","收盤價");
value3=GetSymbolField("6505.tw","收盤價");
value4=GetSymbolField("2412.tw","收盤價");
value5=GetSymbolField("2882.tw","收盤價");
value6=GetSymbolField("1301.tw","收盤價");
value7=GetSymbolField("1303.tw","收盤價");
value8=GetSymbolField("1326.tw","收盤價");
value9=GetSymbolField("3008.tw","收盤價");
value10=GetSymbolField("2881.tw","收盤價");
value11=GetSymbolField("2454.tw","收盤價");
value12=GetSymbolField("2891.tw","收盤價");
value13=GetSymbolField("2002.tw","收盤價");
value14=GetSymbolField("1216.tw","收盤價");
value15=GetSymbolField("2311.tw","收盤價");
value16=GetSymbolField("2886.tw","收盤價");
value17=GetSymbolField("2912.tw","收盤價");
value18=GetSymbolField("2474.tw","收盤價");
value19=GetSymbolField("2382.tw","收盤價");
value20=GetSymbolField("2408.tw","收盤價");
value21=GetSymbolField("2892.tw","收盤價");
value22=GetSymbolField("5880.tw","收盤價");
value23=GetSymbolField("2357.tw","收盤價");
value24=GetSymbolField("2884.tw","收盤價");
value25=GetSymbolField("2207.tw","收盤價");
value26=GetSymbolField("4938.tw","收盤價");
value27=GetSymbolField("2880.tw","收盤價");
value28=GetSymbolField("2303.tw","收盤價");
value29=GetSymbolField("2105.tw","收盤價");
value30=GetSymbolField("2885.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;

plot1(count-15);

畫出來的圖如下

2018010501

這個想法拿來作為短線多空的方向是不錯,直接拿來作期指交易,回測的情況不優,需要更細緻的寫法,未來若有新的發現,再跟大家報告

你可能會有興趣的文章

回應