老师好,
KD金叉,KD值小于50,收盘价≥MA40日均线,开多1手,收盘价触摸MA20日均线下方,多单止盈,收盘价小于MA40,多单止损;
KD死叉,KD值大于70,收盘价≤MA40之下,开空1手,收盘价触摸MA20日均线上方,空单止盈,收盘价大于MA40,空单止损,这一段公式怎么写。谢谢!
“收盘价触摸MA20日均线下方”这个如何理解?详细说明下。
input:n(9,1,100,10),p1(3,2,40,4),p2(3,2,40,4);//参数设置
ma40:ma(c,40);
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,P1,1);
D:SMA(K,P2,1);
J:3*K-2*D;
kdjjc:cross(k,d);//kdj金叉
kdjsc:cross(d,k);
if kdjjc and k<50 and d<50 and c>ma40 then
begin
buy(holding=0,1,MARKET);
end
if holding>0 and c<=ma40 then sell(holding>0,holding,market);
if kdjsc and k>70 and d>70 and c<ma40 then
begin
buyshort(holding=0,1,MARKET);
end
if holding<0 and c>=ma40 then sellshort(holding<0,holding,market);
参考上面这个代码。
[此贴子已经被作者于2019/1/30 16:12:11编辑过]