以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]currentbar  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=69787)

--  作者:optimus
--  发布时间:2014/9/10 13:15:29
--  [原创]currentbar
请问Easylanguage里的 CurrentBar 保留变量 在金字塔里对应的是什么函数或用法?
--  作者:pyd
--  发布时间:2014/9/10 13:20:03
--  
CurrentBar 请解释下
--  作者:王锋
--  发布时间:2014/9/10 13:24:57
--  
看看是不是BARPOS
--  作者:optimus
--  发布时间:2014/9/10 13:25:15
--  回复:(pyd)CurrentBar 请解释下
就是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.


--  作者:pyd
--  发布时间:2014/9/10 13:26:54
--  

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


--  作者:optimus
--  发布时间:2014/9/10 13:28:45
--  回复:(pyd)看3楼的回复,你试试函数barpos效果
好的,我试试
--  作者:optimus
--  发布时间:2014/9/10 13:29:05
--  回复:(王锋)看看是不是BARPOS
好的,我试试