Wednesday, December 17, 2008

Do the Opposite

My favorite episode of Seinfeld involved George making a startling revelation. http://www.youtube.com/watch?v=cKUvKE3bQlY
So. . . as I'm fiddling around with the 3 finger lead system I realized that it might be interesting to test the short side of this concept for mean reversion to the NYAD. Since using the NYAD for these comparisons is a bit risky because of the characteristic skewed volatility, I used QQQQ, DIA and GE as Data 2,3 and 4. I could have chosen other candidates for data 2-4, and you are welcome to explore the possibilities of this lead/lag system that follows the pack.
Rereading the text accompanying the original 3 finger lead post should clarify the intent of the code.
While the short side doesn't trigger a lot of trades (less than 1 a month), the holding time of 12 days means you are actually exposed for about 37% of the time.
TS2000i code is shown below:
Inputs have been optimized for IWM (as usual) and must be re-optimized when using other data 1-4.
Blogger has again refused to let me post the open code due to the <> symbols. Sorry. I'll try and post the open code in the comments section later today for you copy and pasters.

5 comments:

bzbtrader said...

Code for 3 finger reverse for cut and paste:

Inputs: Len1(28), Len2(18), Len3(12), Check(8);
Variables: Dat(0), Dat2(0), Dat3(0), Dat4(0);

If Close Data1 < Average(Close Data1, Len1)
AND Dat = 0 Then Dat = 1;

If Dat <> 0 AND Dat <= Check Then Begin
If Close Data2 < Lowest(Close Data2, Len2)[1] Then Dat2 = 1;
If Close Data3 < Lowest(Close Data3, Len2)[1] Then Dat3 = 1;
If Close Data4 < Lowest(Close Data4, Len2)[1] Then Dat4 = 1;
Dat = Dat + 1;
End
Else
Dat = 0;

If Dat <> 0 AND Dat2 + Dat3 + Dat4 = 3 Then Begin
Sell This Bar at Close;
Dat2 = 0;
Dat3 = 0;
Dat4 = 0;
Dat = 0;
End;

If BarsSinceEntry = Len3
Then ExitShort This Bar at Close;

See the body of the post today for correct text alignment.

Red Hue said...

BZB,

When you have a chance...could you describe your entry and exit for this in english...for those of us who do not speak TS2000i?

: )

bzbtrader said...

This version only trades short, as opposed to the 3 finger lead, which only traded long. This is the type of trade to scale in on, although pyramiding has not been turned on.
Basically, we're looking for lower closes in the 3 indices, while Data1 is showing a level of weakness by holding below a moving average (Len1). Once lower closes in the 3 indices hold for a period of time (Check(10)), a Sell order is triggered.
The Data fields are then reset to zero to avoid false Sell triggers.
Finally, the system simply exits on the 12th day of the position, although entries may be delayed from the original trigger by Check(10)(the trigger confirmation)so holding time may be reduced to only 9 days.
This is a trend following system that uses the weakness in DIA(30 stocks), the Qs(100 stocks) and GE to trigger a sell in a larger basket (IWM - 2000 stocks).

jb said...

BZB,

Q: When you said Once lower closes in the 3 indices hold for a period of time (Check(10)) are you saying that all three indices are in the condition Data2 < Lowest(Close Data2, Len2)[1] for 10 days? Or are you waiting 10 days till sell? Or ???

Merry Xmas!

jb

bzbtrader said...

Jb,
OK, sorry for the confusion. This one gets me a litle confused myself because of all the variations of it I'm working on. . so disregard the (CHECK 10) value response to Red Hue (sorry Red Hue),as I was looking at the 3 finger lead code when I posted that comment after about 3 hours sleep(no excuse).
Here we go . . . .
First. . we're looking for IWM to make a close lower than the MA lookback Len1.
Second, We track the underlying Data 2-4 looking for the lowest close for a lagged lookback period(Len2[1]).
Third, our confirmation (Check(8))occurs when all Data 2-4 make new low Closes, although not necessarily at the same time.
Fourth, when the last of the 3 Data 2-4 trigger, then we'll SELL that bar at the close.
Fifth, EXITshort is on a fixed bar (12), although a trailing stop exit (not shown in the code) is an alternate way to close the position.
Sixth, all switches are reset to zero to start the count all over again.