variable:rsv_d(0),KK(0),dd(0); //宣告3個變數
stochastic(9,3,3,rsv_d,KK,dd); //XQ內建寫好的KD函數==>呼叫他
variable:dif_d(0),macd_d(0),osc_d(0);
MACD(weightedclose(),12,26,9,dif_d,macd_d,osc_d);//XQ內建寫好的MACD函數==>呼叫他
//KD指標部份
condition1 = KK >= dd; //條件一:K值>=D值
condition2 = KK < dd; //條件二:K值<D值
condition3 = KK cross over dd; //條件三:k值 黃金交叉 D值 瞬間
condition4 = KK cross under dd; //條件四:K值 死叉交叉 D值 瞬間
condition5 = close >= average(close,20); //條件五:close >= 月線 [average平均(close收盤價,20天)]
//MACD指標部份
condition6 = dif_d >=0 and macd_d >=0; //條件六:MACD雙線上0軸 ==>趨勢偏多
condition7 = dif_d <0 and macd_d <0; //條件七:MACD雙線下0軸 ==>趨勢偏空
condition8 = osc_d>=0; //條件八:MACD紅柱 ==>強度偏強
condition9 = osc_d<0; //條件九:MACD綠柱 ==>強度偏弱
condition10 = dif_d cross over macd_d; //條件十:DIF線(快) 黃金交叉 MACD線(慢) 瞬間 ==>轉紅柱瞬間
condition11 = dif_d cross under macd_d; //條件十一:DIF線(快) 死亡交叉 MACD線(慢) 瞬間 ==>轉綠柱瞬間
if condition1 and condition5 and condition6 and condition8 then Plot1(high,"K值>=D值且股價在月線之上且MACD上0軸且MACD是紅柱"); //if如果 condition件 成立 then然後就plot 畫圖
if condition2 then Plot2(high,"K值<D值");
if condition3 and condition5 and condition6 and condition8 then Plot3(low,"K值黃金交叉D值且股價在月線之上且MACD上0軸且MACD是紅柱");
if condition4 then Plot4(high,"K值 死亡交叉 D值");
if condition10 then Plot5(low,"轉紅柱瞬間");
if condition11 then Plot6(low,"轉綠柱瞬間");
以上程式是指標程式,請問如何改為選股程式,也就是每天執行選股時,可選出箭頭第1根的股票
1 評論