Kama
Kama AFL might specifically focus on the Kaufman Adaptive Moving Average (KAMA) indicator. It could offer insights into trend direction or volatility adjustments based on KAMA calculations. Utilizing an Amibroker data feed, this AFL aids traders in making informed decisions based on KAMA’s adaptive nature.
/// AMA System by Karthikmarar // Two adjustable parameter "Buy sensitivity" and "Buy Finetune" provided to adjust entry points. // Two adjustable parameter "Sell sensitivity" and "Sell Finetune" provided to adjust Exit points. _SECTION_BEGIN("AMA System"); /* Version 1.1 Modified on : 28-11-2006 Original Code : http://www.traderji.com/67020-post435.html Reference material : http://trader.online.pl/MSZ/e-w-Kaufmans_Adaptive_Moving_Average_II.html */ SetChartOptions(0, chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC(C, 1 ) ) )); // Buy adjustments bPeriods = Param("BUY Sensitivity",10,2,20,1); bF = Param("BUY Finetune",2,0.1,20,0.1); // Sell Adjustments sPeriods = Param("SELL Sensitivity",3,2,20,1); sF = Param("SELL Finetune",1,0.1,20,0.1); // common fast = 2/(2+1); // 0.666 // Fast end factor slow = 2/(30+1); // 0.0645 // Slow end factor //BUY part bDir = abs( Close - Ref(Close, -bPeriods) ); // Signal:=abs(Pr-Ref(Pr,-Periods)); bVol = Sum( abs(Close - Ref(Close, -1)) , bPeriods); // Sum of Noise for the given period bER = bDir/bVol; // EffRatio = If(Noise>0.,Signal/Noise,0.); // FERatio = FEndF*EffRatio+SEndF*(1-EffRatio); bSc = ( bER*(fast - slow) + slow )^2; // SmoothF = Power(FERatio,2)) bX = AMA( C, bSc ); // AMA value /* the Filter itself is based on the volatility Filter = k * (change in Kama value)std dev */ bFilter = bF * StDev( bX-Ref(bX,-1), 20); j = bX - Ref(bX, -3); //SELL part sDir = abs(Close-Ref(Close, -sPeriods)); sVol = Sum(abs( Close - Ref(Close, -1) ), sPeriods); sER = sDir/sVol; sSc = ( sER*(fast - slow) + slow)^2; sX = AMA( C, sSc ); sFilter= sF *StDev( sX - Ref(sX, -1), 20); k = Ref(sX, -3) - sX; /* BUY when the AMA turns up and SELL when it turns down */ Buy = Cross(j, bFilter); Sell = Cross(k, sFilter); mycolor = IIf(C > bX, colorLime, colorRed); Plot( C, "Close", mycolor, styleNoTitle | styleBar | styleThick ); Plot( bX, "kamaBuy", colorBrown, styleLine, 1); Plot( sX, "kamaSell", colorBlue, styleLine, 1); Buy = ExRem(Buy, Sell); Sell = ExRem(Sell, Buy); shape = Buy * shapeUpArrow + Sell * shapeDownArrow ; PlotShapes( shape, IIf( Buy, colorGreen, colorBrown ),0, IIf( Buy, Low, High ) ); GraphXSpace = 5; dist = 1.5*ATR(20); for( i = 0; i < BarCount; i++ ) { if( Buy[i] ) PlotText( "Buy\n@" + C[i], i, L[i] - dist[i], colorLime ); if( Sell[i] ) PlotText( "sell\n@" + C[i], i, L[i] + dist[i], colorBrown ); } _SECTION_END();