公式网-网站导航


网站搜索:  

公式指标网 发表于2016/2/19 7:29:37

通达信日内满仓反手的写法源码

因为满仓的情况下,要等平仓单成交、保证金释放后,开仓下单才能成功。
 用系统自带的orderqueue在平仓单没有第一时间成交的情况下有一定的局限性,可用如下的方法:
runmode:0;
 input:cw(3,1,10,1);
 variable:cc=0;
 ma5:=ma(c,5);
 ma20:=ma(c,20);
 entertime:=time>100000 and time<144500;
 if holding>0 and cc<=0 then sell(1,cw,limitr,o);
 if holding<0 and cc>=0 then sellshort(1,cw,limitr,o);
 //此方法撤单和追单时间要控制在出信号的K线时间以内
if holding=0 and cc>0 and cw+tholding2>=cw then buy(1,cw,limitr,o);//平空成交后,"cw+tholding2>=cw "才会成立并开多
if holding=0 and cc<0 and cw-tholding2>=cw then buyshort(1,cw,limitr,o);//平多成交后,"cw-tholding2>=cw "才会成立并开空
if cc>0 and ma5<ma20 then cc:=0;
 if cc<0 and ma5>ma20 then cc:=0;
 if cc=0 and ma5>ma20 and entertime then cc:=1;
 if cc=0 and ma5<ma20 and entertime then cc:=-1;
 if time>=150000 then begin
 cc:=0;
 end
 



网站搜索:  



Copyright © 2009-2010 gszb.com ™,All Rights Reserved. 
公式网-www.gszx.com.cn-股票指标公式网