Rss & SiteMap

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

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

标题:请教编码2

1楼
c100010592 发表于:2016/6/14 10:42:23
以下思路,请教怎么编码实现:

入场规则:
RAVI=绝对值(100*(7天收盘价移动平均-65天收盘价移动平均)/  65天收盘价移动平均))
1、RAVI>0.5%
2、如连续3个收盘价 > 65天收盘价移动平均, 则开多头,如连续3个收盘价  < 65天收盘价移动平均, 则开空头

出场规则:
初始止损1000元,14日新高退出空头 或 14日新低退出多头

以上在日线上运行

请教,谢谢 !
2楼
jinzhe 发表于:2016/6/14 10:50:51

RAVI>0.5%

ravi是上面公式里面算出来的,还是要除以100?

3楼
c100010592 发表于:2016/6/14 10:58:53
不好意思,有误,

入场规则:
RAVI=绝对值(7天收盘价移动平均-65天收盘价移动平均)/  65天收盘价移动平均)
1、RAVI>0.5%

也就是要除以100
4楼
jinzhe 发表于:2016/6/14 11:02:31

ravi:abs((ma(c,7)-ma(c,65))/ma(c,65));

if ravi>0.005 and all(c>ma(c,65),3) then buy(holding=0,1,marketr);
if RAVI>0.005 and all(c<ma(c,65),3) then buyshort(holding=0,1,marketr);

if openprofit<-1000 and enterbars>0 then BEGIN
   sell(1,0,marketr);
   sellshort(1,0,marketr);
end


if h=hhv(h,14) and holding<0 then sellshort(1,0,MARKETr);
if l=llv(l,14) and holding>0 then sell(1,0,marketr);

5楼
c100010592 发表于:2016/6/14 14:15:24
增加一条规则:

上次平仓后三个交易日内不开仓

这样怎么编?谢谢!
6楼
jinzhe 发表于:2016/6/14 14:27:39

variabe:bj=0;

ravi:abs((ma(c,7)-ma(c,65))/ma(c,65));

if ravi>0.005 and all(c>ma(c,65),3) and bj=0 then buy(holding=0,1,marketr);
if RAVI>0.005 and all(c<ma(c,65),3) and bj=0 then buyshort(holding=0,1,marketr);

if openprofit<-1000 and enterbars>0 and holding<>0 then BEGIN
   sell(1,0,marketr);
   sellshort(1,0,marketr);

   bj:=1;
end


if h=hhv(h,14) and holding<0 then begin

    sellshort(1,0,MARKETr);

    bj:=1;

end
if l=llv(l,14) and holding>0 then begin

    sell(1,0,marketr);

    bj:=1;

end

if barslast(holding=0 and ref(holding<>0,1)) then bj:=0;

共6 条记录, 每页显示 10 条, 页签: [1]


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