Board logo

标题: 求助:如果实现上下轨画线? [开拓者 TB] [打印本页]

作者: 龙听    时间: 2019-8-3 16:14     标题: 求助:如果实现上下轨画线? [开拓者 TB]

咨询内容: 我的模型是晚上21:00开盘到21:25分间,产生5根5分钟K线,取这5根5分钟K线中的最高点及最低点分别为区间的上轨及下轨,分别用水平线画出来,当价格穿越上下轨时发出警告信号,代码如下:
Params

        Numeric Hanstime(0.2125);
    Numeric Extime(0.2300);
Vars
        NumericSeries UpBand;
        NumericSeries DnBand;
Begin
         if(0.2100<= CurrentTime && CurrentTime<=0.2125)
          {
           UpBand = Highest(H,5);
           DnBand = Lowest(L,5);
           PlotNumeric("UpBand",UpBand,0,yellow,0);
           PlotNumeric("DnBand",DnBand,0,yellow,0);
          }
        if (AlertEnabled && CrossOver(UpBand,DnBand))
        {
                Alert("Do Alert Now");
        }
End
请大神指教!


来源:CXH99.COM

TB技术人员: 问题出在哪里?


TB客服: CrossOver(UpBand,DnBand)
这个有问题吧?
上穿或下穿应该这样写吧?CrossOver(close,UpBand)or crossunder(close,DnBand)


网友回复:
vars
    numericseries upband;
    numericseries dnband;
begin
    if(truedate(0)!=truedate(1))
    {
        upband = high;
        dnband = low;
    }else if(time>0.21 && time<0.2130)
   {
       upband = max(upband,high);
       dnband = min(dnband,low);
   }
    PlotNumeric("UpBand",UpBand,0,yellow);
    PlotNumeric("DnBand",DnBand,0,yellow);
    if(high>upband || low<dnband)
    {
         alert("do alert now");
   }
end
复制代码


网友回复:
小米 发表于 2018-11-8 09:27

终于可以把上下轨画出来了,非常感谢!




欢迎光临 龙听期货论坛 (http://www.qhlt.cn/) Powered by Discuz! 7.2