| 
 PureBytes Links 
Trading Reference Links 
 | 
EnableScript ("jscript");
  
<% 
Reversal =  0.2;
function  FillLine( startbar, startval, endbar, endval 
)
{ 
for( j = startbar; j 
<= endbar; j++ )
{ 
ZigArray[ j ] = startval + ( j - startbar) * (endval-startval)/( endbar - 
startbar ); 
} 
} 
  
High = VBArray( AFL( "High") ).toArray();
Low = VBArray( AFL( "Low" ) ).toArray();
ZigArray = Low; 
Maximum = High[  0 ];
Minimum = Low[  0 
];
MinBar =  0;
MaxBar =  0;
startbar =  0;
if ( High[ 1 ] > High[ 0 ] )
{ 
dir =  1;
Extremum = Low[  0 ];
} 
else 
{ 
dir = - 1;
Extremum = High[  0 ];
} 
ExBar =  0;
for ( i = 1; i < High.length; i++ )
{ 
if ( High[ i ] > Maximum )
{ 
Maximum = High[ i ]; 
MaxBar = i; 
} 
if ( Low[ i ] < Minimum )
{ 
Minimum = Low[ i ]; 
MinBar = i; 
} 
if ( dir == 1 && ( Minimum < (1- Reversal ) * Maximum ) )
{ 
FillLine( ExBar, Extremum, MaxBar, Maximum ); 
Extremum = Maximum; 
ExBar = MaxBar; 
Maximum = Minimum; 
MaxBar = MinBar; 
dir = - 1;
} 
if ( dir == -1 && ( Maximum > (1+ Reversal ) * Minimum ) )
{ 
FillLine( ExBar, Extremum, MinBar, Minimum ); 
Extremum = Minimum; 
ExBar = MinBar; 
Minimum = Maximum; 
MinBar = MaxBar; 
dir =  1;
} 
  
} 
AFL( "graph0") = 
ZigArray;
%> 
Graph1 = Close; 
Graph1Style =  64; 
  ----- Original Message -----  
  
  
  Sent: Wednesday, December 22, 2004 6:58 
  AM 
  Subject: Re: [amibroker] Looking for Zig 
  Zag code, prefer AFL code. 
  
  Hi Graham,
 
  > > Don't get me wrong, but 
  the help screens are always a good place to start > SYNTAX  
  zig(ARRAY, change ) > RETURNS ARRAY > FUNCTION  Calculates 
  the minimum % change Zig Zag indicator. Caveat: this > function is based 
  on Zig-Zag indicator and may look into the future - this > means that 
  you can get unrealistic results when back testing trading system > 
  using this indicator. This function is provided rather for pattern 
  and trend > recognition formulas. > EXAMPLE 
  zig(close,5) >
 
  OK, I find what you talk about in the AB help 
  file.
  But, what I am looking for is full AFL code, not the ready to use 
  indicator. In other words, I am looking for the full AFL code of the zig 
  indicator.
  Cheers.
  Tintin92
 
  > Cheers, > 
  Graham > http://e-wire.net.au/~eb_kavan/ >
 
 
  Check 
  AmiBroker web page at: http://www.amibroker.com/
  Check 
  group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  
 
  
  
    
  No virus found in this incoming message. Checked by AVG 
  Anti-Virus. Version: 7.0.296 / Virus Database: 265.6.0 - Release Date: 
  12/17/2004
  
  
Check AmiBroker web page at: 
http://www.amibroker.com/ 
 
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  
 
 
 
Yahoo! Groups Links 
 |  
 No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.0 - Release Date: 12/17/2004
 
 |