Skip to main content

Keltner Bands for Amibroker (AFL)

iraj_kaveh over 12 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 4)
  • Tags:
    amibroker, bands

Keltner Bands, 20-Days Period, ATR, Multiplier 1, 2 and 3

Screenshots

Indicator / Formula

Copy & Paste Friendly
// Keltner Bands, Version 1.0 //
// Developed By: Iraj Kaveh, iraj_kaveh@yahoo.com //

_SECTION_BEGIN("Keltner Bands");
P = ParamField("Price field",-1);
Style = ParamStyle("Style", styleLine );
CenterLine = EMA( P, 20 );
KTop1   = CenterLine + 1 * ATR( 10 );
KBot1 = CenterLine - 1 * ATR( 10 );

KTop2   = CenterLine + 2 * ATR( 10 );
KBot2 = CenterLine - 2 * ATR( 10 );

KTop3   = CenterLine + 3 * ATR( 10 );
KBot3 = CenterLine - 3 * ATR( 10 );

Plot( KTop1, "KBTop1" + _PARAM_VALUES(), colorGreen, Style ); 
Plot( KBot1, "KBBot1" + _PARAM_VALUES(), colorGreen, Style ); 

Plot( KTop2, "KBTop2" + _PARAM_VALUES(), colorRed, Style ); 
Plot( KBot2, "KBBot2" + _PARAM_VALUES(), colorRed, Style ); 

Plot( KTop3, "KBTop3" + _PARAM_VALUES(), colorBlue, Style ); 
Plot( KBot3, "KBBot3" + _PARAM_VALUES(), colorBlue, Style ); 

Plot( CenterLine, "Center Line", colorWhite, styleLine | styleDashed );
_SECTION_END();

_SECTION_BEGIN("Price Chart");
_N(Title = StrFormat("{{NAME}}- {{INTERVAL}} {{DATE}} O= %g, H= %g, L= %g, C= %g (%.1f%%) V= " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C, SelectedValue(ROC( C, 1 )) ));
PriceStyle = GetPriceStyle();
PriceStyleOpt = ParamStyle("Price Style")|PriceStyle;

if (PriceStyle==styleCandle)
   Plot( C, "", colorBlack,  PriceStyleOpt); 
else
   Plot( C, "", IIf( Close >= Ref(C, -1), colorGreen, colorRed ), PriceStyleOpt);
_SECTION_END();

1 comments

Leave Comment

Please login here to leave a comment.