PureBytes Links
Trading Reference Links
|
Dans un courrier daté du 17/12/98 22:39:41 Heure d10iver Pari41 Madrid,
wayne@xxxxxxxxx a écrit :
Snip
>
> On Aug. 26 and 27 an indicator called $%B was discussed under the
> subject: Message pops up say can’t divide by zero. The formula, as
> given, was quit convoluted involving many parameters. Pierre Orphelin
> reduced it to a simpler form but missed the simplest form: 100(price -
> AvgPrice)/coeff*xStdDev. Price - AvgPrice is just a common oscillator.
> It can be divided by a number of different parameters that tend to keep
> an oscillator bound within the same limits for different commodities,
> e.g. AvgTrueRange. In fact, using AvgTrueRange gives almost the same
> curve. $%B is not bound such as stochastic where the numerator can only
> go from 0 to 1.
>
and Snip
and warned that the published cofe was not the simplest ( the goal at this
time was more basic and invited to avoid this kind of error:
Plot1(((100*(Price-$Lowerband(Price,Length,SDev))/($Upperband(Price,Length,SDe
v)-Lowerband(Price,Length,SDev)))-50)*2,"Place");
Then I wrote:
<<
The other advantage is that the code is more understandable with this
writing.
Now if you dig more into the upperband -lowerband code difference, you should
see that its the same than calculating 2*Stdev (price, length) in the above
expression (not verified but I'm quite sure . Just edit the user functions and
see what's in it. Most of somplifications can be done by rewriting user
functions).
In fact , it seems to me that the above code is what is known as %B. (same
calculation than %R with the up low Bollinger bands in lieu of highest(h,
length) and lowest(l, length) ).
>>
This is what you have done with your *simplest* solution
100(price - AvgPrice)/coeff*xStdDev.
But unfortunately, it's not the simplest solution that I suggested:
Your code calculates the average function TWO times, one being buried in the
Stddev function.
This can be simplified again, making the code faster by less readable (
understandable), because you will need to rewrite the Stddev function and
extract the average from it.
It was beyond the scope of this post.
Often , formula are written close to the basic underlying idea.
Optimizing for speed is better for computer language, but not for human
understanding.
Maybe we need both:
One ( non optimized ) for understanding the concept
One for achieving maximum TS speed.
Sincerely,
-Pierre Orphelin
www.sirtrade.com
|