求解!我的画竖线代码错在哪里?

Discussion in 'AmiBroker' started by zbk, Oct 24, 2012.

  1. zbk

    zbk

    俺写了个代码,在北京时间下午3点(图表上是凌晨3点)欧洲开盘后,在图表上画一条竖线标记。可是运行后却提示错误,不知道什么原因。。求解。。

    Plot(IIf(time = 0300),1,0),"vertical lines", colorGrey50,1|styleHistogram|styleDashed|styleOwnScale|styleNoLabel,0,1);
     
  2. 红线部分看上去有点不对。time = 0300 能行?
     
  3. zbk

    zbk

    哈哈。。搞定了。。正确代码如下:

    Plot(IIf(TimeNum()> 025958 AND TimeNum()< 030000,1,0),"vertical lines", colorGrey50,1|styleHistogram|styleDashed|styleOwnScale|styleNoLabel,0,1);

    应该用TimeNum函数。但是我如果写成TimeNum() = 025959,却不能画线,不知为何。。
     
  4. Plot( TimeNum () == 30000, "vertical lines", colorGrey50, 1 | styleHistogram | styleDashed | styleOwnScale | styleNoLabel, 0, 1 );
     
  5. zbk

    zbk

    030000整数时间不能划线,改成下面的代码就可以了。。多谢。。

    Plot( TimeNum () == 025959, "vertical lines", colorBlue, 1 | styleHistogram | styleDashed | styleOwnScale | styleNoLabel, 0, 1 );
     
  6. It can

    [​IMG]

    Use start time of interval in "Tools - Preferences"

    Then this will work

    Plot (TimeNum () == 30000, "vertical lines", colorGrey50, 1 | styleHistogram | styleDashed | styleOwnScale | styleNoLabel, 0, 1);