TC2000.com• Download software • Tutorial videos • Subscription & data-feed pricing • Class schedule
TC2000Brokerage.com• New account application • Trading resources • Margin rates • Stock & option commissions
Worden Discussion Forum » Customer Training & Support » PCFs, EasyScan and Custom Indicators » Bull And Bear Balance Indicator
Hello
I would love to recreate the Bull And Bear Balance Indicator for TC2000, I especially want to use it within easyscan, to search for crossovers ?
Has this been done before for TC, as I know many of the traders articles get coded for TC2000?
Thanks M
The base bull formula would seem to be:
IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L))))))
The base bear formula would seem to be:
IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L))))))
With the histogram just being the difference between the two.
IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) - IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L))))))
The article recommends smoothing these values with moving averages.
Wow, works like a charm thanks Bruce. I added as an indicator and figured out the smoothing.
If I now want to create an easyscan, I created the below simple above/below - but I would like to (1) add smooting, say 5 period to each, and (2) then create a scan for cross-overs, with a large pcf like below I dont know where to add the periods (.1) etc so I can do below say 3 bars ago, above 1 bar ago ?
(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L))))))) > (IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L)))))))
Every single O, H, L, or C without an offset parameter already would get an offset parameter. So for say 3 bars ago would become O3, H3, L3, and C3. The only thing with an offset parameter already would be C1, so you would add the offset to the existing offset parameter. So for say 3 bars ago would become C4 instead of C1.
All of that said, XUP() and XDOWN() functions were added to the Personal Criteria Formula Language in TC2000 v17 which makes it so you may not need to do offsets.
Let's say you wanted to check for if the 5 period simple moving average of the base bull formula crossed up through its own 2 period simple moving average (so the second line was a 2 period simple moving average of the 5 period simple average of the base bull formula).
XUP(AVG(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))), 5), AVG(AVG(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))), 5), 2))
And it very well should generate numbers as that is what is described in the S&C article. I cannot write a formula generating a signal without some indication as to what you want the signal to be based on. What needs to happen before the signal returns true?
The Crossing Up Value signal on line zero !
The indicator doesn't even cross through zero (although it can equal zero).
So I guess, above zero:
IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) > 0
Equals zero:
IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) = 0
Switching from zero to above zero:
TrueInRow(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) > 0, 2) = 1
Switching from above zero to zero:
TrueInRow(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) = 0, 2) = 1
Maybe you are interested in the Histogram instead? It actually does cross through zero.
Above Zero:
IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) > IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L))))))
Below Zero:
IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) < IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L))))))
Crossing Up Zero:
TrueInRow(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) > IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L)))))), 2) = 1
Crossing Down Zero:
TrueInRow(IIF(C < O, IIF(C1 < O, GREATEST(H - C1, C - L), GREATEST(H - O, C - L)), IIF(C > O, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(H - C > C - L, IIF(C1 < O, GREATEST(H - C1, C - L), H - O), IIF(H - C < C - L, IIF(C1 > O, H - L, GREATEST(O - C1, H - L)), IIF(C1 > O, GREATEST(H - O, C - L), IIF(C1 < O, GREATEST(O - C1, H - L), H - L)))))) < IIF(C < O, IIF(C1 > O, GREATEST(C1 - O, H - L), H-L), IIF(C > O, IIF(C1 > O, GREATEST(C1 - L, H - C), GREATEST(O - L, H - C)), IIF(H - C > C - L, IIF(C1 > O, GREATEST(C1 - O, H - L), H - L), IIF(H - C < C - L, IIF(C1 > O, GREATEST(C1 - L, H - C), O - L), IIF(C1 > O, GREATEST(C1 - O, H - L), IIF(C1 < O, GREATEST(O - L, H - C), H - L)))))), 2) = 1
You're welcome.