De volgende indicator geeft een foutmelding.
Iemand dit werkend krijgt ?
------------
http://www.traders.com/Documentation/FE ... adestation
TRADESTATION: Bull And Bear Balance Indicator
Vadim Gimelfarb's article in this issue, "Bull And Bear Balance Indicator," describes a method of deducing market sentiment from close-to-close price movement. His system uses the various possible relationships between the previous close and current open, high, low, and close. Based on the pattern that each day exhibits, the indicator uses a pattern-specific calculation to determine bull and bear strength for the day.
In our code example, his categories are determined with several nested if-then-else statements. While they look a bit complex, they are really just assigning one of 11 bull categories to the day, then calculating the appropriate "bull power." After this is done, the code assigns one of 11 bear categories and does the appropriate bear power calculation.
As predicted by Gimelfarb, the resulting indicator is fairly noisy. He suggests averaging both the bear power and bull power calculations, then subtracting one from the other. Several averages are mentioned, so we have provided two averaging parameters for tweaking the indicator. The first is a length of an exponential average for both bull and bear calculations (the input named "Avg" in the code). The second is a length of an exponential moving average of the difference between bull power and bear power (the input named "Smoothing" in the code). This second average smooths the difference and produces the finished indicator (Figure 1).
Figure 1: TRADESTATION, BULL AND BEAR BALANCE INDICATOR. Here's a sample TradeStation chart demonstrating the smoothed bull and bear balance indicator on the S&P 500 e-mini. The histogram (the red vertical lines) shows the value of the bull and bear indicator at each bar.
---------
{Indicator: BullAndBear:}
inputs:
Avg( 20 ),
Smoothing( 5 ) ;
variables:
BullPower( 0 ),
BearPower( 0 ) ;
{Bull Power}
If Close < Open then
If Close[1] < Open then
?BullPower =
? MaxList(High - Close[1], Close - Low )
else
?BullPower =
? MaxList(High - Open, Close - Low)
else
If( Close > Open ) then
?If Close[1] > Open then
? BullPower = High - Low
?else
? BullPower =
? ?MaxList(Open - Close[1], High - Low )
else
?If( High - Close > Close - Low ) then
? If Close[1]< Open then
? ?BullPower = MaxList( High - ?Close[1],
? ? Close - Low )
? else
? ?BullPower = High - Open
?else
? If High - Close < Close - Low then
? ?If Close[1] > Open then
? ? BullPower = High - Low
? ?else
? ? BullPower = MaxList(Open - Close[1],
? ? ?High - Low )
? else
? ?If Close[1] > O then
? ? BullPower = MaxList( High - Open,
? ? ?Close - Low )
? ?else
? ? If Close[1] < O then
? ? ?BullPower = MaxList( Open
? ? ? - Close[1], High - Low )
? ? else
? ? ?BullPower = High - Low ;
If C<O then
If Close[1]>Open then
?BearPower = MaxList(Close[1]- Open,High - Low )
else
?BearPower = High - Low
else
If Close > Open then
?If Close[1] > Open then
? BearPower = Maxlist( Close[1] - Low, High
? ?- Close)
?else
? BearPower = Maxlist(Open - Low, High
? ?- Close )
else
?If High - Close > Close - Low then
? If Close[1] > Open then
? ?BearPower = MaxList(Close[1]-Open,
? ? High - Low )
? else
? ?BearPower = High - Low
?else
? If High - Close < Close - Low then
? ?If Close[1]>Open then
? ? BearPower = MaxList(Close[1]-Low,
? ? ?High - Close )
? ?else
? ? BearPower = Open - Low
? else
? ?If Close[1]> Open then
? ? BearPower = MaxList(Close[1]-Open,
? ? ?High - Low )
? ?else
? ? If Close[1]<O then
? ? ?BearPower = MaxList(Open - Low,
? ? ? High - Close)
? ? else
? ? ?BearPower = High - Low ;
plot1( Xaverage( XAverage( BullPower, Avg )
- XAverage( BearPower, Avg ),Smoothing ));