以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  请问这个 这个指标红色字体错在哪里,应该怎么修改?  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=181275)

--  作者:wxx212
--  发布时间:2020/7/19 16:55:12
--  请问这个 这个指标红色字体错在哪里,应该怎么修改?
VARIABLE:status=0,top_line=0,floor_line=0;
{当收盘价上穿top_line的时候, status=1,top_line=x上1  floor_line只能朝上,不能朝下(即 ref(floor_line,1)<= x下1 取 max(ref(floor_line,1), x下1)}
{当收盘价下穿floor_line的时候, status=-1,  floor_line=x下1,  top_line只能朝下,不能朝上(即 ref(top_line,1)>= x下1 取 min(ref(top_line,1), x上1)}
x上1:=llv(hhv(h,2),2),LINETHICK1,colorred;
x下1:=hhv(llv(l,2),2),LINETHICK1,colorgreen;

floor_line0:=max(ref(floor_line,1),x下1);
top_line0:=min(ref(top_line,1),x上1);
top_line1:=ref(top_line,1);
floor_line1:=ref(floor_line,1);

if status=0 then begin
top_line:=x上1;
floor_line:=x下1;
end;
if  top_line1>=c and top_line<c  then begin
status:=1;
end;
if floor_line1<=c and floor_line>c then begin
status:=-1;

end;
if  status=1 then begin
top_line:=x上1;
floor_line:=max(floor_line1,x下1);
end;
if status=-1 then begin
top_line:=min(x上1,floor_line1);
floor_line:=x下1;
end;
tt:top_line;
pp:floor_line;


STICKLINE(status=-1 and CLOSE<OPEN ,OPEN,CLOSE,8,0),colorgreen;
STICKLINE(status=-1 and CLOSE>=OPEN ,OPEN,CLOSE,8,1),colorgreen;
STICKLINE(status=-1 , HIGH,MAX(OPEN,CLOSE),0,0),colorgreen;
STICKLINE(status=-1 , MIN(OPEN,CLOSE),LOW,0,0),colorgreen;
STICKLINE(status=1 and CLOSE>=OPEN ,OPEN,CLOSE,8,1),COLORMAGENTA;
STICKLINE(status=1  and CLOSE<OPEN ,OPEN,CLOSE,8,0),COLORMAGENTA;
STICKLINE(status=1 , HIGH,MAX(OPEN,CLOSE),0,0),COLORMAGENTA;
STICKLINE(status=1 , MIN(OPEN,CLOSE),LOW,0,0),COLORMAGENTA;


{
KD:=;          //开多条件
PD:=;          //平多条件
KK:=;          //开空条件
PK:=;          //平空条件


平空:SELLSHORT(PK,1,THISCLOSE);                  //平空信号
开多:BUY(KD AND HOLDING=0,1,THISCLOSE);          //开多信号
平多:SELL(PD,1,THISCLOSE);                       //平多信号
开空:BUYSHORT(KK AND HOLDING=0,1,THISCLOSE);     //开空信号

}
{
信号语句排列规则——先平后开
“费率设置”按钮——用于合理设置模型“费率”,以便在图形上正确输出如下帐户信息:

持仓:holding,linethick0;
资产:asset,noaxis;
可用现金:cash(0),linethick0;

您可以在查看菜单->交易系统模板 中设置自己需要的模板
}

--  作者:wenarm
--  发布时间:2020/7/20 8:16:21
--  
请具体说明你遇到的问题。单独的代码没法具体分析。