Rss & SiteMap

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

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

标题:K线没信号

1楼
lyric 发表于:2017/6/27 10:20:59
老师好,我代码里面有两个出场条件,一个全平,一个平半仓,但是我平半仓的条件,五年都没有信号,请老师解决一下
2楼
pyd 发表于:2017/6/27 10:24:44

代码贴出了看下

3楼
lyric 发表于:2017/6/27 10:28:39
input:ma_length(12,5,60,1),tp_length(30,3,40,2);//均线参数
INPUT:RiskRatio(1,0,10,1);
INPUT:p(0.05,0.01,1,0.01);
INPUT:SDLen(100,80,120,1);

variable:long_ss=1,short_ss=1,dzt=0,kzt=0;
variable:平多bar=1,平空bar=1;
variable:dzyss=0,kzyss=0;

my_ma:ref(ma(c,ma_length),3);
my_ma_1:=ref(ma(c,ma_length),1);
zf:=(c-ref(o,5))/ref(o,5);
zf_1:=ref(zf,1);

n_high:=ref(hhv(h,tp_length),1);
n_low:=ref(llv(l,tp_length),1);
m :=floor(SDLen*p);
s1 :=large(zf,SDLen,m);
s2 :=small(zf,SDLen,m);

//进场
long_entry_inst:=ref(c,1)>ref(my_ma,1) and h>=n_high;

short_entry_inst:=ref(c,1)<ref(my_ma,1) and l<=n_low;
//出场
long_final_leave:=l<=my_ma;
short_final_leave:=h>=my_ma;

多状态:dzt,NODRAW;
空状态:kzt,NODRAW;
//////////////////////////////////////////////////////////////////
if long_final_leave and holding>0   then begin//多头
  LONG_EXIT_PRICE1:=my_ma;
  sell(1,holding,limitr,LONG_EXIT_PRICE1);
  平多bar:=barpos;dzt:=0;
 end 
 if zf_1>s1 and holding>0 and dzt=2 then begin
  LONG_EXIT_PRICE2:=open;
  dzyss:=floor(long_ss/2);
  sell(1,dzyss,limitr,LONG_EXIT_PRICE2);
 dzt:=1;
end

if short_final_leave and holding<0  then begin//空头
  SHORT_EXIT_PRICE1:=open;
  sellshort(1,abs(holding),limitr,SHORT_EXIT_PRICE1);
  平空bar:=barpos;kzt:=0;
end
if zf_1<s2 and holding<0 and kzt=2  then begin
  SHORT_EXIT_PRICE2:=open;
  kzyss:=floor(abs(holding)/2);
  sell(1,dzyss,limitr,SHORT_EXIT_PRICE2);
 kzt:=1;
end
/////////////////////////////////////////////////////////////////

if long_entry_inst and holding=0 and 平多bar<>barpos and dzt=0 then begin
  long_entry_price:=n_high;
  long_ss:=floor((ASSET*RiskRatio)/(100*multiplier*(n_high-my_ma)));
  buy(1,long_ss,limitr,long_entry_price);
  dzt:=2;
end

if short_entry_inst and holding=0 and 平空bar<>barpos and kzt=0 then begin
  short_entry_price:=n_low;
  short_ss:=floor((ASSET*RiskRatio)/(100*multiplier*(my_ma-n_low)));
  buyshort(1,short_ss,limitr,short_entry_price);
  kzt:=2;
end
4楼
pyd 发表于:2017/6/27 10:32:03

限价的价格超过k线范围会出现白色箭头,加开平仓后边加上ignorecheckprice,例如

sell(1,holding,limitr,long_exit_price1),ignorecheckprice;

sellshort(1,abs(holding),limitr,short_exit_price1),ignorecheckprice;

 buy(1,long_ss,limitr,long_entry_price),ignorecheckprice;

 buyshort(1,short_ss,limitr,short_entry_price),ignorecheckprice;

[此贴子已经被作者于2017/6/27 10:36:17编辑过]
5楼
lyric 发表于:2017/6/27 10:34:18
螺纹钢 日线
6楼
lyric 发表于:2017/6/27 10:38:53
没用的,跟之前没有变化,还是没有平半仓的信号
7楼
lyric 发表于:2017/6/27 10:42:20
改了没变化 还是没有平半仓信号
8楼
pyd 发表于:2017/6/27 10:48:28

信号如图 


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看
9楼
lyric 发表于:2017/6/27 10:50:46
我从2012.1.1到2017.6.25只交易了53次,平半仓信号都没有,但是在其他平台上都有的,在TB上交易了72次
10楼
lyric 发表于:2017/6/27 10:52:57
我用螺纹指数做的回测
共11 条记录, 每页显示 10 条, 页签: [1] [2]


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