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

Triple Divergence EL help



PureBytes Links

Trading Reference Links

I have coded this system which returns accurate buy and sell signals. 

It also gives false signals and when I run the chartscanner with end of day
data no active orders or open positions get picked up even though they exist
on the charts.

I have Max bars back set adequately. I have turned off the Max calculation
speed setting in the chartscanner. The chartscanner runs with my other systems
just fine.

I have even taken all the "while","for", and "buffer" statements out of the
code to make it barebones.

What am I missing?  I am stumped!

Here is the code...................

									
								      {Parameters}

Inputs:  Length(50);

Vars: RSIOsc(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);

   RSIOsc = Rsi(close,7);

                                  {Identify 3 SHB's and 3 RSI SHB's}
   Ok2sell = -1;
   Value1 =3;


 
   SHB1 = SWINGHIGHBAR(1,close,Value1,Length);

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

   						{Identify Triple Bearish Divergence}

   If SHB3RSI <>-1 Then 
   Begin
		Condition1 = (Close[SHB1] > Close [SHB2]) and (close[SHB2] > close[SHB3]);	
		Condition2 = (RSIOsc[SHB1RSI] < RSIOsc[SHB2rsi]) and 					
(RSIOsc[SHB2RSI] < RSIOsc[SHB3RSI]);
		
		If  Condition1 and Condition2  Then
            Begin
                ok2sell = 1;
            End;
   End;
  
   If ok2sell = 1 and marketposition = 0 then sell at close; 		{Generate Short
Signal}


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

   ok2buy = -1;
   Value1 = 3;
 
       SLB1 = SWINGLOWBAR(1,close,Value1,Length);

     If SLB1 <> -1 Then
	    SLB2 = SwingLowBar(2,close,Value1,Length); 
     If SLB2 <> -1 Then
	   SLB3 = SwingLowBar(3,close,Value1,Length);
     If SLB3 <> -1 Then
	  SLB1RSI = SwingLowBar(1,RSIOsc,Value1,length);
     If SLB1RSI <> -1 Then
	  SLB2RSI = SwingLowBar(2,RSIOsc,Value1,Length);
     If SLB2RSI <> -1 Then
        SLB3RSI = SwingLowBar(3,RSIOsc, Value1,Length);

							{Identify Triple Bullish Divergence}

    If SLB3RSI <>-1 Then 
    Begin
	   Condition5 = (close[SLB1] < close[SLB2]) and (close[SLB2] < close[SLB3]);	
	   Condition6 = (RSIOsc[SLB1RSI] > RSIOsc[SLB2RSI]) and 					
(RSIOsc[SLB2RSI] > RSIOsc[SLB3RSI]);
	  
	   If  Condition5 and Condition6   Then
         Begin
            ok2buy = 1;
         End;
    End;
   
    If ok2buy = 1 and marketposition = 0  then buy at close; 			{Generate Long
Signal}