Skip to main content

ALMA KAMA



_SECTION_BEGIN("KAMA - Kaufman Adaptive Moving Average");

LBPeriods = Param( "LB Periods", 81, 1, 200, 1 );

FSCPeriods = Param( "FSC Periods", 15, 1, 200, 1 );

SSCPeriods = Param( "SSC Periods", 30, 1, 200, 1 );

FastSmoothConst = 2 / ( FSCPeriods + 1 );

SlowSmoothConst = 2 / ( SSCPeriods + 1 );

Direction = abs( Close - Ref( Close, -LBPeriods ) );

Volatility = Sum( abs( Close - Ref( Close, -1 ) ), LBPeriods );

EfficiencyRatio = Direction / Volatility;

SC = ( EfficiencyRatio * ( FastSmoothConst - SlowSmoothConst ) +
SlowSmoothConst ) ^ 2;

KAMA = AMA( Close, SC );

Plot( KAMA, "KAMA", ParamColor( "Color", colorRed ), styleLine );

_SECTION_END();

"Arnaud Legoux Moving Average";
/*________________________________________________________________________________________________
AFL code by hiscores. Originally posted here http://finance.groups.yahoo.com/grou...message/154257

Minor mod by rmike to Modify the AFL in conformance with NinjaTrader & Metatrader
releases by the original developer.

Release Date - 09 Nov 10

AFL Usage - Moving Average. Further information Can be found at http://www.arnaudlegoux.com/
________________________________________________________________________________________________*/

_SECTION_BEGIN("ALMA");
p = ParamField("Price Field");
windowSize = Param("Window Size", 111, 5, 201, 2);
sigma = Param("Sigma", 1, 1, 20);
Offset = Param("Offset", 0.85, 0.05, 1.0, 0.05);

m = floor(Offset * (windowSize - 1));
s = windowSize / sigma;

w = 0;
wSum = 0;

for(i = 1; i < windowSize; i++)
{
     w[i] = exp(-((i-m)*(i-m))/(2*s*s));
     wSum += w[i];
}

for(i = 1; i < windowSize; i++)
{
     w[i] = w[i] / wSum;
}

alma = Null;

for(j = 1; j < BarCount; j++)
{
     alSum = 0;

     if(j < windowSize)
     {
         alma[j] = Null;
     }
     else
     {
         for(i = 1; i < windowSize; i++)
         {
             alSum += p[j - (windowSize - 1 - i)] * w[i];
         }

         alma[j] = alSum;
     }
}

Plot(alma, "ALMA("+windowSize+","+sigma+","+Offset+")", ParamColor("ALMA Color", colorBrightGreen), ParamStyle("ALMA Style", styleLine|styleThick|styleNoLabel), maskDefault); 
_SECTION_END();

Comments

Popular posts from this blog

STAN WEINSTEIN'S STRATEGY - Halan Manoj Kumar

// THIS AFL INCORPORATES MOST OF THE CONCEPTS OF STAN WEINSTEINS TRADING METHODOLOGY. // USE ONLY WEEKLY CHART. // THIS AFL DOES NOT GUARANTEE ANY POSITIVE RETURNS. // USE THIS AFL AT YOUR OWN RISK // THIS AFL WAS DEVELOPED BY HALAN MANOJ KUMAR, MSC,CAIIB,FRM,PRM,CMA,ACMA. HOWEVER IN SOME CASES INDIVIDUAL CODE SNIPPETS ARE FROM DIFFERENT SOURCES AND I THANK THOSE DEVELOPERS. // ANY CONCEPTUAL QUERIES OR COMMENTS CAN BE MAILED TO scorpiomanoj73@gmail.com _SECTION_BEGIN("CHART"); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%)", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END(); //RELATIVE STRENGTH // IF YOUR NIFTY TRADING SYMBOL IS DIFFERENT, PLEASE USE THAT INSTEAD OF ONE MENTIONED HERE. rsmaPeriod...

10K AFL FREE INTRADAY TRADING.afl

_SECTION_BEGIN("Price1"); SetChartOptions(0,chartShowArrows|chartShowDates); Plot( C, "Close", ParamColor("Color", colorRed ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END(); //_SECTION_BEGIN("Pivot")     YH = TimeFrameGetPrice("H", inDaily, -1);        // yesterdays high     YL = TimeFrameGetPrice("L", inDaily, -1);        //                low     YC = TimeFrameGetPrice("C", inDaily, -1);        //                close     YO = TimeFrameGetPrice("O", inDaily);            // current day open     //Normal Pivot     PP = (YH + YL + YC) / 3;     R1 = (2 * PP) - YL;     R2 = PP + (YH - YL); ...

Wilders Most Succesful Intraday Intraday

PM1 = Param("MA1",7.5,1,1500,1); PM2 = Param("MA2",11,1,1500,1); M1 = Wilders(Close,PM1); M2 = Wilders(Close,PM2); A = Cross(M1,M2); B = Cross(M2,M1); Hor1=Param(" LEFT/RIGHT",1,1,1660,1); Ver1=Param(" UP DOWN",35,1,830,1); FS1=Param(" Font Size",15,11,100,1); GfxSelectFont("Tahoma", FS1, 200 ); GfxSetBkColor(colorBlack); GfxSetTextColor(colorGold); //GfxTextOut("EMA "+ PM1 + " "+ Prec(M1,2),Hor1,Ver1); GfxSetTextColor(colorGreen); //GfxTextOut("EMA "+ PM2 + " "+ Prec(M2,2),Hor1,Ver1+25); Plot(M1," EMA: "+pm1,ParamColor("FAST EMA COLOR",colorBrightGreen)); Plot(M2," EMA: "+pm2,ParamColor("SLOW EMA COLOR",colorRed)); PlotShapes(IIf(A,shapeUpArrow,shapeNone),colorBrightGreen,0,L,Offset= -30); PlotShapes(IIf(B,shapeDownArrow,shapeNone),colorRed,0,H,Offset = -30); Filter = (A == 1) OR (B == 1); AddColumn(A,"BUY/SELL",1,IIf(A,colorGreen,c...