PureBytes Links
Trading Reference Links
|
Bob,
Thank you for the question. This is a rather sticky topic that deserves a
good explanation.
The @CurrentBar and @BarNumber KeyWords (OK, they are functions) are to
all appearances identical. The difference is that @BarNumber is a series
function, meaning that it can be de-referenced with a StudyBar value.
The statement
Value1 = @CurrentBar of one bar ago ;
will not verify while the statement :
Value1 = @BarNumber of one bar ago ;
is perfectly valid. Examining functions like @HighestBar, @MRO and
@SwingHighBar will help you to understand this difference. Assume you make
a call like :
Value2 = @HighestBar (High, 05) [01] ;
I want the number of bars ago of the highest bar of the last five bars
starting one bar ago... Let us assume that @CurrentBar is one hundred
(100) and @FastHighestBar returned a value of four (4).
> HighestBar = FastHighestBar (Price, Length) + CurrentBar - BarNumber ;
Well, the @FastHighestBar function has already been back adjusted by the
study bar modifier ("[01]") of the @HighestBar function. Somehow we need
to return to the user a value of five (4 + 1) to include the StudyBar
reference. Remember, @BarNumber is going to has been backed up one bar and
is now equal to ninety nine (99).
@CurrentBar - @BarNumber = 100 - 99 = 1
We add the value one (1) from our equation above to the four (4) from the
@FastHighestBar function and get the correct value of five (5).
I hope this answers your question. In general, always use @BarNumber
inside a User Function unless you have a very good reason not to!
Samuel
At 06:43 AM 05/10/99 , you wrote:
>Hi Sam:
>
>What is the difference between CurrentBar and BarNumber?
>
>I have never seen any.
>
>But I just noticed a version of the HighestBar function that is just:
>
> HighestBar = FastHighestBar(Price, Length) + CurrentBar - BarNumber;
>
>I understand the FastHighestBar function but do not understand what the
other terms accomplish.
>
>Thanks.
>Bob
Samuel K. Tennis Vista Research
129 Staff Drive voice: 1(850) 243-5105
Ft. Walton Beach, FL 32548 fax: 1(850) 301-2884
<MailTo:skt@xxxxxxxxxxxxxxxxxx> <http://www.vista-research.com/>
***** EasyLanguage Spoken Here *****
|