Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:公式编写

1楼
llq 发表于:2019/1/11 11:13:04
老师好,KD金叉,收盘价在MA40日之上,开多1手,收盘价连续2根K线在MA20之下,平多1手;KD死叉,收盘价在MA40之下,开空1手,收盘价连续2根在MA20之上,平空。每日收盘后不论涨跌全部平仓,这个公式怎么写。谢谢!
2楼
FireScript 发表于:2019/1/11 11:31:30
 参考下面的范例:

input:n(9,1,100,10),p1(3,2,40,4),p2(3,2,40,4);//参数设置

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;


ma40:ma(c,40);//40周期均线
ma20:ma(c,20);
kdjjc:cross(k,d);//kdj金叉
kdjsc:cross(d,k);

if count(c<ma20,2)=2 then sell(holding>0,holding,market);//平多

if c>ma40 and kdjjc  then
begin
buy(holding=0,1,MARKET);
end

if count(c>ma20,2)=2 then sellshort(holding<0,holding,market);//平空

if c<ma40 and kdjsc then
begin
buyshort(holding=0,1,MARKET);
end

if time=CLOSETIME(0)  then //收盘平仓,日线以上周期无效。
begin
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);   
end
共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.01953 s, 3 queries.