InvestorsHub Logo
icon url

Vesselin

09/03/02 7:02 PM

#101 RE: Tom K #98

Backtesting the second system

If the Aroon Oscillator is at or below -50, you must
wait until the CCI crosses from below to above -200.


The word "wait until" confuses me a bit. Suppose that today the system is out of the market and AroonOsc is below -50. Which of the following is the proper way to proceed:

1) Since AroonOsc is less than -50, check whether CCI has crossed above -200. If it has, Buy. Otherwise, do nothing. Perform this check (for both the AroonOsc and CCI) every day.

2) Since Aroon Osc has dropped below -50, start waiting for the CCI to cross above -200. That is, once we enter this state, every day, no matter what the value of the AroonOsc is from now on, check the CCI and Buy as soon as it crosses above -200.

I know that they sound similar but they aren't exactly the same. The first rule is "more natural" while the second is more correctly described by the phrase "wait for...". Which of the two did you mean? For now, I am assuming the first; if I am wrong, I'll correct the program.

SHORT RULES (green arrows)
Short if the CCI crosses from above to below +100 as
long as the Aroon Oscillator is below "0".


That's good - but what are the Cover rules? :-) Does the system cover when a Buy signal occurs? This doesn't seem to be the case, according to your chart - the system has stayed Short from September 2000 to September 2001, yet there have been several Buy signals in-between.

Because of the incompleteness of the Short trade rules, I have omitted them from my WealthScript implementation (appended at the end of this message).

Backtesting shows that the system performs quite well in bull markets (backtested since the 80s) - but is disastrous in bear markets. It had series of losing trades since May 2000 and another one in September 1998 - another bad time for the bulls. The simple addition of a stop-loss doesn't help the matters much, because the system keeps trying to go Long as the market keeps getting oversold. Hopefully, adding proper Short trading rules would improve the results.

1) Sell signals in strong up trends tend to be
early, but not all together bad.


Yep; they are quite good, actually.

2) This system failed to generate a buy signal in
'99, missing the entire rally that lead to the Q1
2000 peak.


This was "unnatural time". Even a human technician was likely to stay out of the market during that time. There was no reason for the markets to go up, yet they continued to go up, killing any attempt to short them.

3) Check out the last buy signal. The system went
totally haywire. Obviously, stops would have kept
loses from going out of control.


Yes, the system needs adjustment for bear markets. And, no, a simple stop-loss doesn't help.

4) The CCI is a bit erratic. It's difficult to see exactly
when it crosses above and below overbought and oversold
levels.


Oh, a computer has no problems with that. :-)

Regards,
Vesselin

Anyway, here is the WealthScript implementation. I have tried to make it easily modifiable - the parameters are grouped at the top, there are do-nothing paceholders where the code controlling the Short trades should be, and so on. A pity that this site does not seem to have the equivalent of the <tt> HTML tag (suppressing the text formatting and using a non-proportional font), or the program wouldn't look so awful (no identation, all lines flushed to the left, etc.).

const AroonPeriod = 200;
const AroonHigh = 50;
const AroonLow = -50;
const AroonNeutral = 0;
const CCIPeriod = 80;
const CCILow = -100;
const CCILower = -200;
const CCIHigh = 100;
const CCIHigher = 200;
const StopLoss = 10;

var AroonPane, CCIPane, AroonOsc, MyCCI, Bar, StartBar, EndBar: integer;

HideVolume;

CCIPane := CreatePane(60, False, True);
SetPaneMinMax(CCIPane, CCILower - 10, CCIHigher + 10);
MyCCI := CCISeries(CCIPeriod);
PlotSeries(MyCCI, CCIPane, #Black, #Thick);
DrawHorzLine(CCILow, CCIPane, #Red, #Thin);
DrawHorzLine(CCILower, CCIPane, #Red, #Thick);
DrawHorzLine(0, CCIPane, #Red, #Dotted);
DrawHorzLine(CCIHigh, CCIPane, #Red, #Thin);
DrawHorzLine(CCIHigher, CCIPane, #Red, #Thick);
DrawLabel(GetDescription(MyCCI), CCIPane);

AroonPane := CreatePane(60, False, True);
SetPaneMinMax(AroonPane, AroonLow - 10, AroonHigh + 10);
AroonOsc := SubtractSeries(AroonUpSeries (#Close, AroonPeriod),
AroonDownSeries(#Close, AroonPeriod));
PlotSeries(AroonOsc, AroonPane, #Black, #Thick);
DrawHorzLine(AroonHigh, AroonPane, #Blue, #Thick);
DrawHorzLine(AroonLow, AroonPane, #Blue, #Thick);
DrawHorzLine(AroonNeutral, AroonPane, #Black, #Dotted);
DrawLabel('Aroon Osc (' + IntToStr(AroonPeriod) + ')', AroonPane);

InstallStopLoss(StopLoss);

StartBar := AroonPeriod;
EndBar := BarCount - 1;

for Bar := StartBar to EndBar do
begin
ApplyAutoStops(Bar);
if LastPositionActive then
begin
if PositionLong(LastPosition) then
begin
{ Long Position Exit Rules }
if GetSeriesValue(Bar, AroonOsc) < AroonHigh then
begin
if CrossUnderValue(Bar, MyCCI, CCIHigh) then
SellAtMarket(Bar + 1, LastPosition, '');
end
else
begin
if CrossUnderValue(Bar, MyCCI, CCIHigher) then
SellAtMarket(Bar + 1, LastPosition, '');
end;
end
else
begin
{ Short Position Exit Rules }
if false then
CoverAtMarket(Bar + 1, LastPosition, '');
end;
end
else
begin
{ Long Position Entry Rules }
if GetSeriesValue(Bar, AroonOsc) > AroonLow then
begin
if CrossOverValue(Bar, MyCCI, CCILow) then
BuyAtMarket(Bar + 1, '');
end
else
begin
if CrossOverValue(Bar, MyCCI, CCILower) then
BuyAtMarket(Bar + 1, '');
end;
{ Short Position Entry Rules }
if false then
ShortAtMarket(Bar + 1, '');
end;
end;

icon url

Tom K

09/03/02 7:04 PM

#102 RE: Tom K #98

Aroon filter system: RULES UPDATE...

in bold

BUY RULES
If the CCI crosses from below to above -100 as
long as the Aroon Oscillator isn't at -50 or below.

If the Aroon Oscillator is at or below -50, you must
wait until the CCI crosses below -200 and rises
above -100.


SELL RULES
If the CCI crosses from above to below +100 as
long as the Aroon Oscillator isn't at +50 or above.

If the Aroon Oscillator is at or above +50, you must
wait until the CCI crosses above +200 and falls
below +100.


SHORT RULES (green arrows)
Short if the CCI crosses above +100 and falls below
+100 as long as the Aroon Oscillator is below "0".

Updated chart shows improved sell signals: