在bar replay 回放模式下调试AFL

Discussion in 'AmiBroker' started by espresso, Mar 28, 2012.

  1. 请教一下,哪位大侠有在bar replay 回放模式下调试afl的经验?

    我在 bar replay模式下面调试一段afl代码
    (每次按前进按钮是能看到当前bar上面的变化)
    但是有什么方法能够把当前bar的情况,甚至其他变量的情况显示出来呢?
    我发现在 0 - barcount 的循环里面好像读不到 bar replay这种模式下的当前bar
    关键在于怎么获得这个模式下的当前bar的index...

    不知道各位看懂了没有...

    我的代码是把结果输出到dbgview下面,
    如果哪位能给几行代码演示一下大概方法就好了 :confused:
     
  2. 好像在对应指标等的Parameters设置里的Style里面NoLabel不选中好像就是看到当时对应的bar的指标数据了?!
     
  3. bar replay模式下,AB的数据引擎只提供到最近时点的数据,之后的bar被截取掉了;
    所以当下的BarCount就是公式中所能识别的当前bar的index,
    并且,不仅当前Ticker是如此,在该AB中无论你通过何种方式获取到的报价都是如此。
    该是描述清楚了吧
     
  4. Thanks wj2000 and xMore!

    It's caused by something wrong in my code. AFL actually loops through each bar until the very last one available in replay mode.

    I recently found debugging in bar replay mode is very helpful to find issue that can only be detected in real time exploration during trading, which costs real money. :D
     
  5. 加上这行 SetBarsRequired( sbrAll, sbrAll );

    这样 BarCount 是不是就是实际上的数字?
     
  6. 我没有在indicator里面用这个函数,一般是在scan/exploration里面用。

    bar replay的时候,如果指定范围内有200个bar,那么barcount=200。这是对的。
    这个贴子的问题已经解决了。是我程序里面的一点问题。 :)
     

  7. SetBarsRequired( sbrAll, sbrAll ); 是指忽略缺省设置值,加载该证券所有报价数据执行运算。

    BarCount: 依据上面的设定,指当前参予运算的bar的数量;