欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 我怎么才能在十笔图内的一分钟内只做一次开多,当这一分钟的条件不满足时我也不平仓?

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3237人关注过本帖树形打印复制链接

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

美女呀,离线,留言给我吧!
证通的曹琴
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:98 积分:543 威望:0 精华:0 注册:2013/2/5 10:28:12
我怎么才能在十笔图内的一分钟内只做一次开多,当这一分钟的条件不满足时我也不平仓?  发帖心情 Post By:2013/6/7 11:41:41    Post IP:221.230.140.134[只看该作者]

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

 

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

 

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

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;

 


 


 回到顶部
帅哥哟,离线,有人找我吗?
jinzhe
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/6/7 13:23:14    Post IP:58.246.57.26[只看该作者]

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

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

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

下单语句;

extgbdataset('time',t1);

end



金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
美女呀,离线,留言给我吧!
证通的曹琴
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:98 积分:543 威望:0 精华:0 注册:2013/2/5 10:28:12
  发帖心情 Post By:2013/6/7 13:32:59    Post IP:221.230.140.134[只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下: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楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:98 积分:543 威望:0 精华:0 注册:2013/2/5 10:28:12
  发帖心情 Post By:2013/6/7 13:55:30    Post IP:221.230.140.134[只看该作者]

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

 

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

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;


 回到顶部
帅哥哟,离线,有人找我吗?
jinzhe
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/6/7 14:09:09    Post IP:58.246.57.26[只看该作者]

后台啊,我都是按照后台策略来写的


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部