PureBytes Links
Trading Reference Links
|
Cab,
The problem here is that the AVERAGE function expects as input a type-series data string.
BB1 provides it because it is itself a type series function. BB2 does not provide it because it is type simple. The way to get around this problem is to first cast the simple output of BB2 into a type-series string, which is exactly what the following two lines do....
Value2 = BB1(C,11,2) ;
Value3 = Average(Value2,3) ;
Caveat: this method will not work if written inside a type-simple function because value2 would still be type-simple and casting to type series would not have occurred.
I will be giving a talk about series and simple functions at OmegaWorld.
- Mark Jurik
>
>Once again TradeStation's "Easy Language" is driving me absolutely nuts.
>
>I created two functions, called BB1 and BB2, both of which return the
value of an upper Bollinger Band. BB1 uses the series function of XAverage
and BB2 uses a simple version of XAverage (XAve).
>
>BB1 = XAverage(C,20) + 2*StdDev(C,20) ;
>BB2 = XAve(C,20) + 2*StdDev(C,20) ;
>
>I verified that both BB1 and BB2 return the same values.
>
>Next I created an indicator to plot a 3-bar average of the upper Bollinger
Band:
>
>Value1 = Average(BB1(C,11,2),3) ;
>
>Value2 = BB1(C,11,2) ;
>Value3 = Average(Value2,3) ;
>
>Plot1(Value1,"X") ;
>Plot2(Value3,"Y") ;
>
>The two plots are equivalent-- as they should be-- when I use BB1 (series
version) but not when I use BB2 (simple version).
>
>The root problem is that Value1 returns an incorrect value when using BB2
(simple version).
>
>It's hard to conceive that after all this time I'm still flailing around
with series/ simple stuff. I guess it's not enough that BB1 and BB2 return
the same values ...
>
>If someone has a good explanation for the above, I'd love to hear it.
>
>Cheers,
>
>Cab Vinton cvinton@xxxxxxxxxxx
Samuel K. Tennis Vista Research
129 Staff Drive voice: 1(850) 243-5105
Ft. Walton Beach, FL 32548 fax: 1(850) 301-2884
skt@xxxxxxxxxxxxxxxxxx http://www.vista-research.com/
***** EasyLanguage Spoken Here *****
|