[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Divergence System- How to filter for trends?



PureBytes Links

Trading Reference Links

This is a divergence system which compares the swings of the indicator 
RSIOsc(any oscillating indicator) and the price, close in this case.  It is 
not of my own making but cobbled together from bits and pieces from the 
brains of the list.  
Trade rules:SP 5min close 
identify and store the last 3 swings for price and indicator
Compare the indicator swings to the price swings for divergences
Buy/Sell those divergences as they occur.
Exit with the Chandelier.

The system can be optimized by varying the lookback and does seem to make 
small amounts of money at most lengths, moderately robust.  

1.	But why would I optimize the length for swing highs and lows? They 
either exisit or they don't.

Hard to trade. It is usually about 40-50% right with 2+ avg win and 2+ profit 
factor.  The Chandelier exit gives me a higher (5+) consecutive losses.  But 
I like the way it cuts the losses and lets the profits run.  It is essential 
to this system.  You can activate the Triple osc by elimating the brackets 
for less trades and maybe a higher percent right.

2.	I need a way to identify the stength of the trend.  The problem is 
that the divergences that occur in a strong trend are not tradeable.  This is 
where I get the 5+ losses.    I understand ADX is an effective trend 
identifier by it doesn't seem to be timely with the divergent signals.  
(Maybe one of Jurliks indicators as a filter here?).  

2.	Finally, I seem to be not getting signals for some obvious 
divergences, which are apparently not seen by a specified lookback. How to do 
this without requiring lookback? What, I think I would like to do is to 
identify all (well, some reasonable number) the strength 2 occurences in both 
the indicator and the price and compare the saved lists (arrays?) to one 
another.  I don't know how to use arrays.  maybe use the "occurence" as an 
array member?

The best system will have no manual Inputs:

I'm sorry, the basic system was provided by a generous O-lister that I can't 
remenber, but the Wami filter and oscillator is MarkB's and the Chuck 
LeBeau's Traderclub.com is the source of the Chandelier exit.  
							      {Parameters}

Inputs:  Length(30),stren(2),fac(2.5),reverse(false);

Vars: 	RSIOsc(0),RSIOscLow(0),
		SHB1(0), SHB2(0),SHB3(0),
         	SHB1RSI(0),SHB2RSI(0),SHB3RSI(0),
        	SLB1(0), SLB2(0),SLB3(0), 
		SLB1RSI(0),SLB2RSI(0),SLB3RSI(0),
		ok2sell(0),ok2buy(0);

  	{ This can be any oscillator that you want}
	
	RSIOsc = Xaverage(Xaverage(Xaverage(Close-Close[1],3),5),8);
	RSIOscLow=RSIOsc; {Iwas trying to see if a different osc setting 
would work for the lows}
	                                  {Identify 3 SHB's and 3 RSI SHB's}
   	Ok2sell = -1;
   	Value1 =stren;
	
{This exit sytem uses the chandelier indicator with a reverse option}
IncludeSystem:"Exit#ChnRevrs",FAC,5,REVERSE;

   SHB1 = SWINGHIGHBAR2(1,Close,Value1,Length); {swinghighbar2 allows for 
equal highs at the swing}

   If SHB1 <> -1 Then
	SHB2 = SwingHighBar2(2,Close,Value1,Length);
   If SHB2 <> -1 Then
	SHB3 = SwingHighBar2(3,Close,Value1,Length);
   If SHB3 <> -1 Then
	SHB1RSI = SwingHighBar2(1,RSIosc,Value1,length);
   If SHB1RSI <> -1 Then
	SHB2RSI = SwingHighBar2(2,RSIosc,Value1,Length);
   If SHB2RSI <> -1 Then
	SHB3RSI = SwingHighBar2(3,RSIosc,Value1,Length);

IF Time >= 0720{Bond Session Sess1StartTime7:20} AND Time <= Sess1EndTime-1 
then 
BEGIN
   						{Identify Triple (really 
double, I have bracketed the triple) Bearish Divergence}

   If SHB3RSI <>-1 Then {3 requires a third divergence , but the buy/sell 
signal only tests 1 and 2}
   Begin
		Condition1 = (Close[SHB1] >= Close [SHB2]) 		
						{and (close[SHB2] > 
close[SHB3])};	
		Condition2 = (RSIOsc[SHB1RSI] < RSIOsc[SHB2rsi]) 	
						{and (RSIOsc[SHB2RSI] < 
RSIOsc[SHB3RSI])};
		Condition3 = Wami(3,5,8) <= Wami(3,5,8)[1]; {momentum 
direction}

	If  Condition1 and Condition2 and Condition3  Then
            Begin
                ok2sell = 1;
            End;
   End;
  
   If ok2sell = 1 and marketposition = 0 then 
	{Generate Short Signal} sell at open; 

							    {Identify 3 SLB's 
and 3 RSI SLB's}

   ok2buy = -1;
   Value1 = stren;
 
       SLB1 = SWINGLOWBAR(1,Close,Value1,Length);

     If SLB1 <> -1 Then
	    SLB2 = SwingLowBar2(2,Close,Value1,Length); 
     If SLB2 <> -1 Then
	   SLB3 = SwingLowBar2(3,Close,Value1,Length);
     If SLB3 <> -1 Then
	  SLB1RSI = SwingLowBar2(1,RSIOscLow,Value1,length);
     If SLB1RSI <> -1 Then
	  SLB2RSI = SwingLowBar2(2,RSIOscLow,Value1,Length);
     If SLB2RSI <> -1 Then
        SLB3RSI = SwingLowBar2(3,RSIOscLow, Value1,Length);

							{Identify Triple 
(really double, I have bracketed the triple) Bullish Divergence}

    If SLB3RSI <>-1 Then {3 requires a third divergence , but the buy/sell 
signal only tests 1 and 2}
    Begin
	   Condition5 = (Close[SLB1] <= Close[SLB2]) 		
		{and (close[SLB2] <close[SLB3])};	
	   Condition6 = (RSIOscLow[SLB1RSI] > RSIOscLow[SLB2RSI]) 		
		{and (RSIOscLow[SLB2RSI] > RSIOscLow[SLB3RSI])};
	  Condition7 = Wami(3,5,8) >= Wami(3,5,8)[1];

	   If  Condition5 and Condition6 and Condition7   Then
         Begin
            ok2buy = 1;
         End;
    End;
   
    If ok2buy = 1 and marketposition = 0  then 
	{Generate Long Signal} buy at open; 	

END;