您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

[原创]currentbar [金字塔]

  • 咨询内容: 请问Easylanguage里的 CurrentBar 保留变量 在金字塔里对应的是什么函数或用法?

     

  • 金字塔客服: CurrentBar 请解释下

     

  • 用户回复: 看看是不是BARPOS

     

  • 网友回复: 就是easylanguage写的代码,想转成金字塔。CurrentBar的easylanguage解释是:

    Returns the number of the bar currently being evaluated.

    Each bar on a chart (after the number of bars specified by the Maximum number of bars referenced by a study, known as MaxBarsBack) is assigned a number, which is incremented by 1 with each successive bar. For example, if your MaxBarsBack is set to 10, the 11th bar is CurrentBar number 1, the 12th bar is CurrentBar number 2, and so on.

    Remarks

    CurrentBar can only be used to return the number of the current bar, for example, you cannot use:

    CurrentBar[n]

    ... to obtain the bar number of the bar n bars ago. However, you can obtain the number of the bar n bars ago (for example, 5) by using:

    CurrentBar - 5

    Also, the CurrentBar reserved word is the same as the user function BarNumber. The only difference is that you can use the BarNumber function to reference past bars:

    BarNumber[5]

    Examples

    You can use CurrentBar to determine how long ago a particular condition occurred:

    If Condition1 then
     Value1 = CurrentBar; 
    If CurrentBar > Value1 then
     Value2 = CurrentBar - Value1;

    Value2 would hold the number of bars ago Condition1 occurred.

     

  • 网友回复:

    看3楼的回复,你试试函数barpos效果

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容