Rss & SiteMap

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

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

标题:请教

1楼
zouyingsheng 发表于:2011/10/11 10:45:10

long1:=tsellholdingex('12202822',' ',1)>0 and c>ma4+5*mindiff ;
long2:=tsellholdingex('12202822',' ',1)=0 and c>ma4+5*mindiff and ma42>ref(ma4,1) ;
tsellshort(long1,0,mkt,0,0,'12202822');
tbuy(long2,1,mkt,0,0,'12202822');

 

short1:=tbuyholdingex('12202822',' ',1)>0 and c<ma42-5*mindiff ;
short2:=tbuyholdingex('12202822',' ',1)=0 and c<ma42-5*mindiff and ma4<ref(ma4,1) ;
tsell(short1,0,mkt,0,0,'12202822');
tbuyshort(short2,1,mkt,0,0,'12202822');
 

试运行了一下,持仓判断不对,应怎么改呀?

2楼
just 发表于:2011/10/11 11:03:10

long1:=tsellholdingex('12202822',' ',1)>0 and c>ma4+5*mindiff ;
long2:=tsellholdingex('12202822',' ',1)=0 and c>ma4+5*mindiff and ma42>ref(ma4,1) ;
if long1 then

begin

tsellshort(1,0,mkt,0,0,'12202822');

end

if long2 then

begin
tbuy(1,1,mkt,0,0,'12202822');

end

 

short1:=tbuyholdingex('12202822',' ',1)>0 and c<ma42-5*mindiff ;
short2:=tbuyholdingex('12202822',' ',1)=0 and c<ma42-5*mindiff and ma4<ref(ma4,1) ;
if short1 then

begin

tsell(1,0,mkt,0,0,'12202822');

end

if short2 then

begin
tbuyshort(1,1,mkt,0,0,'12202822');

end
改成这样试试

3楼
fly 发表于:2011/10/11 11:06:55

楼主的写法基本正确.tbuyholdingex('12202822',' ',1)这种写法表示12202822帐户当前品种的所有买持仓

取到的就应该是实际的监控品种的买持仓呀.

 

if tsellholdingex('12202822','',1)>0 and c>ma4+5*mindiff  then tsellshort(1,0,mkt,0,0,'12202822');//有空仓满足条件就平掉

 

//如果想没有空仓,满足条件就开多仓,可以这样写

if tsellholdingex('12202822','',1)=0 and c>ma4+5*mindiff  and ma42>ref(ma4,1) then tbuy(1,0,mkt,0,0,'12202822');

 

//如果想即没有空仓也没有多仓,满足条件才开多仓,这样写

if tsellholdingex('12202822','',1)=0 and tbuyholdingex('12202822',' ',1)=0 and c>ma4+5*mindiff  and ma42>ref(ma4,1) then

tbuy(1,0,mkt,0,0,'12202822');

4楼
zouyingsheng 发表于:2011/10/11 11:07:55
这样改有差别吗? 持仓判断怎么都是0,或是说tbuyholdingex('12202822',' ',1)>0不成立吗?
5楼
fly 发表于:2011/10/11 11:28:58
你的12202822帐户是国内期货公司的帐户?里面有实际持仓吗
6楼
zouyingsheng 发表于:2011/10/11 11:30:39
还是不行,还是判断不到持仓,怎么办?
7楼
fly 发表于:2011/10/11 11:35:24

看看你的tbuyholdingex('12202822','',1)这句,第2个参数,注意中间不要有空格

可用这句话在图表上看看你的该帐户在该品种的持仓是否正确

x:tbuyholdingex('12202822','',1),linethick0;

8楼
zouyingsheng 发表于:2011/10/11 11:51:52
有可能?休市能是吗
9楼
zouyingsheng 发表于:2011/10/11 12:02:05

对了,是空格的问题

共9 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03125 s, 2 queries.