我把李凯老师的演示代码在测试发现图表显示不正确如下图,代码要求收盘前平仓,但图平显示过了夜。代码和图如下,请指正!谢谢!
h30:=ref(hhv(h,30),1);
l30:=ref(llv(l,30),1);
h20:=ref(hhv(h,20),1);
l20:=ref(llv(l,20),1);
long:=h>h30 and time >093000 and time<144500;
if long then
begin
sellshort(holding<0,holding,limitr,h30);
buy(holding=0,1,limitr,h30);
end
partline(1,l30,colorGREEN);
LongX:=l<l20 and holding>0;
if LongX then
begin
Sell(1,0,limitr,l20);
end
Short:=l<l30 and time>093000 and time <144500;
if Short then
begin
Sell(holding>0,0,limitr,l30);
buyshort(holding=0,1,limitr,l30);
end
partline(1,h30,Colorred);
sell(time>145000 and holding>0,0,thisclose);
sellshort(time>145000 and holding<0,0,thisclose);
持仓:holding,linethick0;
资产:asset,noaxis;
可用现金:cash(0),linethick0;
{
信号语句排列规则——先平后开
“费率设置”按钮——用于合理设置模型“费率”,以便在图形上正确输出如下帐户信息:
您可以在查看菜单->交易系统模板 中设置自己需要的模板
}