Rss & SiteMap

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

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

标题:我怎么才能在十笔图内的一分钟内只做一次开多,当这一分钟的条件不满足时我也不平仓?

1楼
证通的曹琴 发表于:2013/6/7 11:41:41

十笔图周期上,因为我的条件是引用一分钟上的数据,所以在十笔图上的一分钟内会出现信号闪的情况,

 

我怎么才能在十笔图内的一分钟内只做一次开多,当这一分钟的条件不满足时我也不平仓?

 

因为我用的是后台万能模板,如下 (他是根据虚拟持仓的不同下单的)

Globalvariable:hold=drawnull;
cc800988:=holding;//这句放在信号稳定的地方

//蓝色部分改为你自己的模型(K线走完模型)
buycond:=count(c>o,2)=2;
sellcond:=count(c<o,2)=2;
if holding>0 and sellcond then sell(1,1,thisclose);
if holding<0 and buycond then sellshort(1,1,thisclose);
if holding=0 and buycond then buy(1,1,thisclose);
if holding=0 and sellcond then buyshort(1,1,thisclose);

 

drawtextex(1,1,800,0,'虚拟持仓为:'+numtostr(cc800988,0));//在图表上输入虚拟持仓以便监控
if not(islastbar) or workmode<>1 then exit;
xiadan800988:=cc800988-hold;
if xiadan800988>0.5 then begin
cang:=min(xiadan800988,abs(hold));
if hold<0 then begin
  tsellshort(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 平空 %.0f',cang);
end
cang:=xiadan800988+min(hold,0);
if cang>0 then begin
  tbuy(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 开多 %.0f',cang);
end
end
if xiadan800988<-0.5 then begin
cang:=min(abs(xiadan800988),abs(hold));
if hold>0 then begin
  tsell(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 平多 %.0f',cang);
end
cang:=abs(xiadan800988)-max(hold,0);
if cang>0 then begin
  tbuyshort(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 开空 %.0f',cang);
end
end
hold:=cc800988;

 


 

2楼
jinzhe 发表于:2013/6/7 13:23:14

思路和上午给你写的差不多,全局变量记录时间,

t1:=floor(time/100);//时间去除秒数,得到小时和分钟数

if islastbar and 持仓判断 and 下单条件  and t1<>extgbdata('time') then begin

下单语句;

extgbdataset('time',t1);

end

3楼
证通的曹琴 发表于:2013/6/7 13:32:59


图片点击可在新窗口打开查看此主题相关图片如下:a%zjjqgycx0pucgmwpa6%m.jpg
图片点击可在新窗口打开查看
加了你的代码后就变成这样了

我写的是

if islastbar and holding>0 and 条件1 and t1<>extgbdata('time')   THEN begin
  sell(1,0,LIMITR,c);
  buyshort(1,ss,LIMITR,c);

  extgbdataset('time',t1);
END

if islastbar and holding<0  and 条件2 and t1<>extgbdata('time')   then begin
  sellshort(1,0,limitr,c);

  buy(1,ss,limitr,c);
  extgbdataset('time',t1);
end

 

????

4楼
证通的曹琴 发表于:2013/6/7 13:55:30

是不是那个代码要加到后台函数里面

 

我改了下那个根据虚拟持仓的下单的后台模板,您给指导下,对不对?

Globalvariable:hold=drawnull;
cc800988:=holding;//这句放在信号稳定的地方

//

我的图表模型代码

//

drawtextex(1,1,800,0,'虚拟持仓为:'+numtostr(cc800988,0));//在图表上输入虚拟持仓以便监控
if not(islastbar) or workmode<>1 then exit;
xiadan800988:=cc800988-hold;
t1:=floor(time/100);
if islastbar and   xiadan800988>0.5 and t1<>extgbdata('time') then begin
cang:=min(xiadan800988,abs(hold));
if   hold<0 then begin
  tsellshort(1,cang,mkt,0,0);
end
cang:=xiadan800988+min(hold,0);
if cang>0  then begin
  tbuy(1,cang,mkt,0,0);
end
 extgbdataset('time',t1);
end

if islastbar and xiadan800988<-0.5 and t1<>extgbdata('time') then begin
cang:=min(abs(xiadan800988),abs(hold));
if hold>0 then begin
  tsell(1,cang,mkt,0,0);
end
cang:=abs(xiadan800988)-max(hold,0);
if cang>0  then begin
  tbuyshort(1,cang,mkt,0,0);
end
 extgbdataset('time',t1);
end
hold:=cc800988;

5楼
jinzhe 发表于:2013/6/7 14:09:09
后台啊,我都是按照后台策略来写的
共5 条记录, 每页显示 10 条, 页签: [1]


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