以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  交易信号不能显示  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=10751)

--  作者:jack
--  发布时间:2012/3/26 10:05:15
--  交易信号不能显示

我是一个新手,正在进行写代码练习,但是我在金字塔2.82下写了一个段简单的代码,为什么不能在图标上显示出来?编译没有错误,我实在不知道错在哪里,请帮我找出来。

 

//×?±??D??±?á?
cond1:="kdj.j"<35 and "kdj.k"<35 and "kdj.d"<35;


//?a?à
if time>093000 and time<145000 then
 begin
  if cond1 and cross("kdj.j","kdj.d") then
   begin
   sellshort(holding<0,0,thisclose);
   buy(0,1,thisclose);
   end
 end
 
//?1?e
if thisclose=(enterprice-0.2*25) then
 sell(holding>0,0,thisclose);
 

//???à
if time>093000 and time<145000 and  "kdj.j">100 then
 sell(holding>0,0,thisclose);
   
//ê??ì
if time=145500 then
 begin
 sell(holding,0,market);
 sellshort(holding,0,market);
 end


--  作者:rushtaotao
--  发布时间:2012/3/26 11:03:08
--  

代码当中都是乱码啊

 

[此贴子已经被作者于2012-3-26 11:03:25编辑过]

--  作者:rushtaotao
--  发布时间:2012/3/26 11:13:22
--  

客服正在处理

 


--  作者:rushtaotao
--  发布时间:2012/3/26 12:40:42
--  

//?á??à??D???à?¨¢?
cond1:="kdj.j"<35 and "kdj.k"<35 and "kdj.d"<35;


//?a?¨¤
if time>093000 and time<145000 then
 begin
  if cond1 and cross("kdj.j","kdj.d") then
   begin
   sellshort(holding<0,0,thisclose);
   buy(1,1,thisclose);
   end
 end
 
//?1?e
if thisclose=(enterprice-0.2*25) then
 sell(holding>0,0,thisclose);
 

//???¨¤
if time>093000 and time<145000 and  "kdj.j">100 then
 sell(holding>0,0,thisclose);
  
//¨o??¨?
if time=145500 then
 begin
 sell(holding,0,market);
 sellshort(holding,0,market);
 end

 

 

 

 

你buy语句中第一个值为0,就说明条件永远不成立,永远都不执行buy语句;试试以上代码,就能出信号了

另外最小变动价位你可以直接用mindiff来替代哦

[此贴子已经被作者于2012-3-26 12:41:33编辑过]