各位大大好
本人是初學者 想在指標中 自製一個指標,
如何在K線中找到 短均線死亡交叉長均線,且記錄出該日期,以那一天為基準,往前回推10天期間的最高收盤價,若今天股價站上那一段期間的最高收盤價,則給予一個指標記號。
舉例 某個股 10日均線死亡交叉50日均線 觸發日期在5/2,則以5/2發生日回推過去10天期間的最高收盤價,若5/8收盤站上此最高收盤價,則5/8出現一個訊號指標。
以下 是我嘗試寫的過程 ,但到日期那邊卡住,再請各位大神 協助說明
謝謝
input: Shortlength(10); setinputname(1,"短期均線期數");
input: Longlength(50); setinputname(2,"長期均線期數");
input: period(10,"計算天數");
If Average(Close,Shortlength) crosses over Average(Close,Longlength) then plot3(low) else noplot(3);
If Average(Close,Shortlength) crosses under Average(Close,Longlength) and Average(Close,Shortlength[1]) < Average(Close,Longlength) then plot4(high) else noplot(4);
if Average(Close,Shortlength) crosses under Average(Close,Longlength) and Average(Close,Shortlength[1]) < Average(Close,Longlength) then value100 = 0 else value100 += 1;
if value100 > 0 then date?;
3 評論