【问题标题】:How to print the date of the bar x bars after the selected bar?如何在所选柱之后打印柱 x 柱的日期?
【发布时间】:2018-09-25 22:37:05
【问题描述】:

在解释窗口中,我想打印所选柱之后 10 个柱之后的柱的日期。假设我选择了 2018 年 9 月 3 日星期一。那么 Amibroker 应该打印“2018-09-17”(10 个交易日后)。首先我尝试了:

if (Status("action") == actionCommentary)
{
printf(DateTimeToStr(DateTimeAdd(SelectedValue(DateTime()), 10, inDaily)));
} 

但是,这只是将日历日期增加了 10 天,因此会打印“2018-09-13”。另一种方法是使用条形索引:

printf("%.0f", SelectedValue(BarIndex() + 10));

但是如何将条形索引转换为日期呢?

【问题讨论】:

    标签: datetime amibroker


    【解决方案1】:

    也许可以尝试价值

    newDate = ValueWhen(SelectedValue(BarIndex() + 10), DateTimeToStr(DateTime()));
    

    Amibroker Help - Valuewhen

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-08
      • 2016-07-07
      • 2018-06-18
      • 2022-11-13
      • 2012-11-18
      • 1970-01-01
      相关资源
      最近更新 更多