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

Re: [amibroker] near perfect Gartley Pattern appears on ES H9 Hourly Chart but ....



PureBytes Links

Trading Reference Links

SetBarsRequired( sbrAll, sbrAll );

for ( r = 1; r < 10;  r++ )
{
    reverse = r /
100;
    kagi[
0] = Low[0];
    j =
0;

    direction[
0] = 0;

   Gartley =
0;
    range =
Null;
    num =
0;

    
for ( i = 1; i < BarCount; i++ )
    {
        
if ( direction[j] == 0 )
        {
            
if ( Low[i] < kagi[j] )
            {
                kagi[j] =
Low[i];
            }
            
else
                
if ( High[i] >= kagi[j]*( 1 + reverse ) )
                {
                    j++;
                    kagi[j] =
High[i];
                    direction[j] =
1;
                }
        }
        
else
        {
            
if ( High[i] > kagi[j] )
            {
                kagi[j] =
High[i];
            }
            
else
                
if ( Low[i] <= kagi[j]* ( 1 - reverse ) )
                {
                    j++;
                    kagi[j] =
Low[i];
                    direction[j] =
0;
                }
        }

        
if ( j > 2 )
        {

            range[j] =
abs( kagi[j] - kagi[j-1] );

            XA = Range[j-
3];
            AB = Range[j-
2];
            BC = Range[j-
1];
            CD = Range[j];

            ulp =
500000; //maximum relative error of the comparison : 1 unit in last place(ulp) represents relative error of 0.00001 %
            C1 =
AlmostEqual( AB,  0.618 *  XA, ulp );
            C2 =
AlmostEqual( BC, 0.382 * AB, ulp ) || AlmostEqual( BC, 0.886 * AB, ulp );
            C3 =
AlmostEqual( CD, 1.27 * BC, ulp ) || AlmostEqual( CD , 1.618 * BC, ulp );

           Gartley = C1 && C2 && C3;

            
if (Gartley)    num++;
            
        }

    }

    
Filter = Gartley;
    
AddColumn( NUM , "% " + r , 1.0 );
}



__._,_.___


**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___