以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 公式模型编写问题提交 (http://222.73.7.161/bbs/list.asp?boardid=4) ---- 均线融合 (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=167396) |
-- 作者:llq -- 发布时间:2018/12/28 10:39:51 -- 均线融合 老师们好,KD金叉,收盘价在30日均线之上开多,怎么编写 KD死叉,收盘价在30日均线下方怎么编写,收盘价跌破30均线平多,收盘价上涨突破30均线平空的公式怎么编写 |
-- 作者:FireScript -- 发布时间:2018/12/28 11:09:46 -- input:n(9,1,100,10),p1(3,2,40,4),p2(3,2,40,4);//参数设置 ma30:ma(c,30); 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);//kdj死叉 if kdjjc and c>ma30 then begin buy(holding=0,1,MARKET);//开多 end if kdjsc and c<ma30 then begin buyshort(holding=0,1,MARKET);//开空 end if cross(c,ma30) and holding<0 then sellshort(1,holding,market);//平空 if cross(ma30,c) and holding>0 then sell(1,holding,market);//平多 |