以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  关于TORDERPRICE  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=77137)

--  作者:leonxu
--  发布时间:2015/3/31 16:28:34
--  关于TORDERPRICE
为了控制不要在同价连续下单,用了这样一个控制,即比如,不连续同价平仓,

if tbuyholding(1)>0 then begin
if TISPRVREMAIN(2)=1 and TORDERPRICE(2,1)=TE then bc:=1;
if bc=0 then tsell(nTE-close>m,1,lmt,TE); 
bc:=1
end

但还是总是连续平到tbuyholding(1)=0为止,不知问题在哪

--  作者:jinzhe
--  发布时间:2015/3/31 16:35:24
--  
请问从哪里能够体现平仓之后留仓的?
--  作者:leonxu
--  发布时间:2015/3/31 16:44:44
--  
整节程序如此
if (CS>CS1 or (nTE<=nTE1-0.4)) then begin//排名下降,下跌一个区间//nBE改成nTE
bc:=if(TISPRVREMAIN(2)=1 and TORDERPRICE(2,1)=TE,1,0);
so:=if(TISPRVREMAIN(3)=1 and TORDERPRICE(3,1)=TE,1,0);
if tholding2<e then begin
if tholding2>-e  then begin
if tholding2<=0 then begin
if tbuyholding(1)>0 then begin
if bc=0 then tsell(nTE-close>m,1,lmt,TE);
bc:=1;so:=1;
end
if tbuyholding(1)=0 then begin
if so=0 then tbuyshort(nTE-close>m,1,lmt,TE);
so:=1;bc:=1;
end
end
if tholding2=1 then begin
if tbuyholding(1)>1 then begin
if bc=0 then tsell(nTE-close>m,2,lmt,TE);
bc:=1;so:=1;
end
if tbuyholding(1)=1 then begin
if bc=0 then tsell(nTE-close>m,1,lmt,TE);
bc:=1;
if so=0 then tbuyshort(nTE-close>m,1,lmt,TE);
so:=1;
end
if tbuyholding(1)=0 then begin
if so=0 and bc=0 then tbuyshort(nTE-close>m,2,lmt,TE);
bc:=1;so:=1;
end
end
if tholding2>1 then begin
if tbuyholding(1)>=2 then begin
if bc=0 then tsell(nTE-close>m,2,lmt,TE);
bc:=1;
if so=0 then tbuyshort(nTE-close>m,1,lmt,TE);
so:=1;
end
if tbuyholding(1)=1 then begin
if bc=0 then tsell(nTE-close>m,1,lmt,TE);
bc:=1;
if so=0 then tbuyshort(nTE-close>m,1,lmt,TE);
so:=1;
end
if tbuyholding(1)=0 then begin
if bc=0 and so=0 then tbuyshort(nTE-close>m,2,lmt,TE);
bc:=1;so:=1;
end
end
end
if tholding2<=-e then begin//极限再平多开空
if ERSI1<=32 then so:=1;
if bc=0 and ERSI1>32 and tbuyholding(1)>1 then begin
tsell(nTE-close>m,2,lmt,TE);
bc:=1;
end
if bc=0 and ERSI1>32 and tbuyholding(1)=1 then begin
tsell(nTE-close>m,1,lmt,TE);
bc:=1;
end
if so=0 and ERSI1ms>32 then begin
tbuyshort(nTE-close>m,1,lmt,TE);
so:=1;
end
end
end
if tholding2>=e and taccount(4)<0 and ERSI1>-32 and down=1 then begin
if bc=0 and tbuyholding(1)>2 then begin
tsell(nTE-close>m,3,lmt,TE);
bc:=1;
so:=1;
end
if bc=0 and tbuyholding(1)>1 then begin
tsell(nTE-close>m,2,lmt,TE);
bc:=1;
end
if bc=0 and tbuyholding(1)=1 then begin
tsell(nTE-close>m,1,lmt,TE);
bc:=1;
end
if so=0 then begin
tbuyshort(nTE-close>m,1,lmt,TE);
tbuyshort(nTE-close>m,1,lmt,TE);
tbuyshort(nTE-close>m,1,lmt,TE);
so:=1;
end
end
end

--  作者:leonxu
--  发布时间:2015/3/31 16:46:45
--  
什么留仓?


--  作者:jinzhe
--  发布时间:2015/3/31 17:20:16
--  

以私信发代码调试

[此贴子已经被作者于2015/3/31 17:20:29编辑过]