以文本方式查看主题

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

--  作者:wb5272
--  发布时间:2013/6/3 9:40:29
--  求诊断
我写个小程序,其中关于成交量的句子v1,我让其显示出来,但是信号和程序表达不一致,我在注释中标出,我查了很久没查出原因,请高手们帮我看一下,多谢。

VARIABLE:buy1=2,cross1=2;
T1:TIME>OPENTIME(1)+500 AND TIME<=OPENTIME(1)+2000;
T2:TIME>OPENTIME(1)+2000 and time<closetime(0)-4000-1500;

多:=(c-l)/c*1000;
空:=(h-c)/c*1000;
方向0:=多-空;
方向:ma(方向0,3);

vol2:=vol;
vol3:=ma(vol,10);
voll:=(vol2/vol3-1)*100-5;
v1:voll;
//这句的v1>100,好像不起作用?请帮我看一下;
if  v1>100 and 方向>0 and t1 then begin
 buy1:=1;
 end;
 if v1>100 and 方向>0 and t2 then begin
 buy2:=1;
 end;
 //这句的v1>100,好像不起作用?请帮我看一下;
 if v1>100 and 方向<0 and t1 then begin
 buy1:=0;
 end;
 
 if v1>100 and 方向<0 and t2 then begin
 buy2:=0;
 end;
 
// if cross(ma(c,5),ma(c,10)) then
// cross1:=1;
// if cross(ma(c,10),ma(c,5)) then
// cross1:=0;
 
 b1:buy1;
 c1:cross1;
 sell(holding>0 and time=closetime(0),0,thisclose);
 sellshort(holding<0 and time=closetime(0),0,thisclose);
 
 sell(buy2=0 and holding>0 and t2,0,thisclose);
 sellshort(buy2=1 and holding<0 and t2,0,thisclose);
 
/买1:buy(buy1 and holding=0 and t1,20%,thisclose);
 买2:buy(buy2 and holding=0 and t2,20%,thisclose);
 
 buyshort(buy1=0 and holding=0 and t1,20%,thisclose);
 buyshort(buy2=0 and holding=0 and t2,20%,thisclose);


--  作者:jinzhe
--  发布时间:2013/6/3 9:50:00
--  
不起作用是从哪里判断出来的?
--  作者:wb5272
--  发布时间:2013/6/4 8:07:38
--  

比如我加在PTA5分钟K线,虽然我设定v1>100时,buy1=1,但实际是v1<100时,buy1却可能变成1了?谢谢


--  作者:jinzhe
--  发布时间:2013/6/4 9:14:17
--  

v1<100,你在哪里进行判断了,赋值语句在哪里?


--  作者:wb5272
--  发布时间:2013/6/10 22:30:35
--  

即/这句的v1>100,好像不起作用?请帮我看一下;
显示的v1虽然小于100,应该不符合条件不能开仓,但是仍然开仓了