Skip to main content

Clear Method for Amibroker (AFL)

levent618 over 15 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 5)
  • Tags:
    amibroker, stop loss

This indicator from TASC September 2010.It is indicate price movement in short term.

Indicator / Formula

Copy & Paste Friendly
//from TASC September 2010
upsw = 0; 
Hh = Lh = H[ 0 ]; 
Hl = Ll = L[ 0 ]; 

for( i = 0; i < BarCount; i++ ) 
{ 
  Ch = H[ i ]; 
  Cl = L[ i ]; 

  if( upsw == 1 ) 
  { 
    Hh = Max( Ch, Hh ); 
    hL = Max( Cl, Hl ); 
     
    if( Ch < Hl ) 
    { 
      upsw = 0; 
      Ll = Cl; 
      Lh = Ch; 
    } 
  } 
   
  if( upsw == 0 ) 
  { 
    Ll = Min( Cl, Ll ); 
    Lh = Min( Ch, Lh ); 

    if( Cl > Lh ) 
    { 
      upsw = 1; 
      Hh = Ch; 
      Hl = Cl; 
    } 
  } 

  Hla[ i ] = Hl; 
  Lha[ i ] = Lh; 
  upswa[ i ] = upsw; 
} 
   
Plot( IIf( upswa == 1, Hla, Null ), "SwLine", ColorRGB( 64, 128, 128), styleThick ); 
Plot( IIf( upswa == 0, Lha, Null ), "SwLine", ColorRGB( 128, 64, 128), styleThick  ); 

Plot( C, "Price", IIf( upswa == 1, 
      ColorBlend( colorGreen, colorWhite ), 
      ColorBlend( colorRed, colorWhite )), styleBar); 

6 comments

over 15 years ago

got error my amibrokerversionis 5.20 got erorr @ Plot( C, “Price”, IIf( upswa == 1,
ColorBlend( colorGreen, colorWhite ),
ColorBlend( colorRed, colorWhite )), styleBar);
athis lines pls slove

Leave Comment

Please login here to leave a comment.