Friday, December 12, 2008

2 High, 2 Low

Just fooling around with the RSI Lag setup and streamlined the code, minus the RSI component to produce this little ditty. This looks a lot like the High Count Reverse (HCR) system that's part of the dirty dozen BZB systems (side panel of blog), but with the slight variation that the entry doesn't necessarily immediately follow the consecutive 2 higher highs or 2 lower lows. The fixed exit on the shorts has been compressed to 6 days, instead of the 9 days for the HCR, but keep in mind that pyramiding was turned on for the HCR and is not enabled here. The practical implication of using pyramiding is that you make more, but you also risk more and deploy more capital with each successive signal. The dramatic skew between the 2H2L holding times for profitable longs (1) and profitable shorts (6) highlights the negative slope of the markets for the majority of the backtesting period.

Code below in TS 2000i format:
Once again I apologize for the Blogger's refusal to let me post the code in open format so you can just paste and copy to your platform. The <> symbols in the TS code seldom transpose to Blogger correctly and frankly I got better things to do than spend 30 frustrating minutes trying to get the thing to format correctly, even when I first copy the copy to word or excel and then repost and repost and repost . . .

2 comments:

Will said...

Bob I'm going to try to post the above code in "copy-and-pasteable" format here. Hopefully it works:
**************

Inputs: Len1(1), Len2(6);

If Low < Low[1] and Low [1] < Low[2]
Then Begin
If Close < Close[1]
Then Buy This Bar at Close;
End;
If BarSinceEntry = Len1
Then ExitLong at Close;

If High > High[1] and High[1] > High[2]
Then Begin
If Close > Close[1]
Then Sell This Bar at Close;
End;
If BarsSinceEntry = Len2
Then ExitShort This Bar at Close;

**************

bzbtrader said...

Thanks Will,
You figured out a way to post the code in a coherent way that I had not thought of. For future posts I'll just post the code as a comment.