-- 作者:证通的曹琴
-- 发布时间: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;
|
-- 作者:证通的曹琴
-- 发布时间: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
????
|
-- 作者:证通的曹琴
-- 发布时间: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;
|