General Trading Chat

amitrandive

Well-Known Member
this is generic version of AMA AFL. by default it will show for the chart TF.

in param usetf = YES and tf = 1440 to get daily band for swing

tf = 15min for intraday

colors of band and MAs you can change suitably so that you can differentate which is intra and which swing :)

Code:
datamode = ParamToggle("Data Mode", "No|Yes", 0) ;
showintitle = ParamToggle("Show in Title", "No|Yes", 0) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;

usetf = ParamToggle("Use TF", "No|Yes", 0) ;
tf = Param("TF", 6, 1, 100000, 1) ;
isexpandLast = ParamToggle("Expand Mode", "First|Last", 1) ;
expandmode = IIf(isexpandLast, expandLast, expandFirst) ;

period = Param("Period", 30, 1, 100, 1) ;
noiseperiod = Param("Noise Period", 5, 1, 100, 1) ;
Clr = ParamColor("AMA Color", colorLightOrange) ;
ClrClose = ParamColor("AMA Close Color", colorOrange) ;

MAwidthper = Param("MA Width %", 0.005, 0, 10, 1) ;
MAwidth = SelectedValue(C) * MAwidthper /100 ;
showasband = ParamToggle("Show as band", "No|Yes", 1) ;
Onlyclose = ParamToggle("Show Only Close", "No|Yes", 0) ;
showclosebias = ParamToggle("Show Close Bias", "No|Yes", 0) ;
Closebiasht = Param("Close bias Ht", 4, 0, 100) ;
Clrbiasup = ParamColor("Color Bias Up", colorSkyblue) ;
Clrbiasdn = ParamColor("Color Bias Down", colorRose) ;
Clrbiasnone = ParamColor("Color Bias None", colorLavender) ;

Clrband = ParamColor("Color Band", colorGold) ;
bandlevel = Param("Level Band", -1, -5, 5, 1) ;
tradearr = ParamToggle("Show Trade Arrow", "No|Yes", 0) ;
triggertypepvt = ParamToggle("Trigger Type", "Bar|Pvt", 0) ;
Onbody= ParamToggle("BO style", "H-L|Body", 1) ;

datamodestyle = styleNoRescale ;
if (NOT showintitle)
	datamodestyle |= styleNoTitle ;
if (NOT showlabel)
	datamodestyle |= styleNoLabel ;

if (datamode)
	datamodestyle = styleNoDraw|styleNoTitle|styleNoLabel|styleNoRescale ;

onlyClosestyle = 0 ;
if (Onlyclose)
	OnlyClosestyle = styleNoDraw ;

tfs = tf *in1Minute ;
if (usetf)
	TimeFrameSet(tfs) ;

tfma = int(Interval()/60) ;
if (usetf AND tfs >= Interval())
	tfma = tf ;

strtf = NumToStr(tfma, 8.0)+"min" ;

Refo = ParamField("TF Open", 0) ;
Refh = ParamField("TF High", 1) ;
Refl = ParamField("TF Low", 2) ;
Refc = ParamField("TF Close", 3) ;
//Refbi = ParamField("BI", 4) ;

//Plot(EMA( Close, period ), "", colorRed) ;
fast = 2/(2+1);
slow = 2/(period+1);
dir=abs(Refc -Ref(Refc ,-noiseperiod ));
vol=Sum(abs(Refc -Ref(Refc,-1)),noiseperiod );
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2; 
amaplotcx = AMA( Refc, sc ); 

dirh=abs(Refh -Ref(Refh ,-noiseperiod ));
volh=Sum(abs(Refh -Ref(Refh,-1)),noiseperiod );
ERh=dirh/volh;
sch =( ERh*(fast-slow)+slow)^2; 
amaplothx = AMA( Refh, sch ); 

dirl=abs(Refl -Ref(Refl ,-noiseperiod ));
voll=Sum(abs(Refl -Ref(Refl,-1)),noiseperiod );
ERl=dirl/voll;
scl =( ERl*(fast-slow)+slow)^2; 
amaplotlx = AMA( Refl, scl ); 

	amaplotc = amaplotcx ;
	amaploth = amaplothx ;
	amaplotl = amaplotlx ;

if (usetf)
{
	amaplotc = TimeFrameExpand(amaplotcx, tfs, expandmode) ;
	amaploth = TimeFrameExpand(amaplothx, tfs, expandmode) ;
	amaplotl = TimeFrameExpand(amaplotlx, tfs, expandmode) ;

	TimeFrameRestore() ;
}

	showoncrb = ParamToggle("Show On CRB", "No|Yes", 0) ;
	Refo = ParamField("CRB Open", 7+0) ;
	Refh = ParamField("CRB High", 7+1) ;
	Refl = ParamField("CRB Low", 7+2) ;
	Refc = ParamField("CRB Close", 7+3) ;
	Refbi = ParamField("CRB BI", 7+4) ;
	Refcrbbars = ParamField("CRB Bars", 7+5) ;
	Refnbars = ParamField("TF Bars", 7+6) ;
	Refdt = ParamField("CRB DT", 7+7) ;


	if (showoncrb)
	{
		diffbars = Refnbars -Refcrbbars -1 ;

		// convert to crb
		Refamaploth = Ref(amaploth, -diffbars) ;
		Refamaplotc = Ref(amaplotc, -diffbars) ;
		Refamaplotl = Ref(amaplotl, -diffbars) ;

//		RefClre = Ref(Clr, -diffbars) ;

		k = 0 ;
		for ( i = Crbst ; i < BarCount ; i++)
		{
			Refbar = Refbi[i];

			Refamaploth[i] = amaploth[Refbar] ;
			Refamaplotc[i] = amaplotc[Refbar] ;
			Refamaplotl[i] = amaplotl[Refbar] ;

//			RefClre[i] = Clr[Refbar];
			k++;
		}
	}
	else
	{
		Refamaploth = amaploth ;
		Refamaplotc = amaplotc ;
		Refamaplotl = amaplotl ;
//		RefClre = Clre ;
	}


Plot(Refamaplotc, strtf+"AMA close"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), ClrClose, styleThick|datamodestyle) ;
Plot(Refamaploth, strtf+"AMA high"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle|OnlyClosestyle) ;
Plot(Refamaplotl, strtf+"AMA low"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle|OnlyClosestyle) ;
if (MAwidth > 0)
	PlotOHLC(Refamaplotc+MAwidth, Refamaplotc+MAwidth, Refamaplotc-MAwidth, Refamaplotc-MAwidth, "", ClrClose , styleCloud|styleNoLabel|datamodestyle) ;
if (showasband)
{
	PlotOHLC(Refamaploth, Refamaploth, Refamaplotl, Refamaplotl, "", Clrband, styleCloud|styleNoLabel|datamodestyle|OnlyClosestyle, 0, 0, 0, bandlevel) ;
}

if (showclosebias)
{
	upside = Refamaploth-(Refamaploth-Refamaplotl)/3 ;
	dnside = Refamaplotl+(Refamaploth-Refamaplotl)/3 ;

	up = Refamaplotc >= upside ;
	dn = Refamaplotc <= dnside ;

	Clr = IIf(up, Clrbiasup, IIf(dn, Clrbiasdn,Clrbiasnone)) ;

	Plot(Closebiasht, "", Clr, styleArea|styleNoLabel|styleOwnScale, 0, 100) ;
}

showparam = ParamToggle("Show Key Param", "No|Yes", 0) ;

if (showparam)
{
	y = (SelectedValue(Refamaploth)+ SelectedValue(Refamaplotl)) /2 ;
	tfsd = tfs ;
	if (tfsd < Interval())
		tfsd = Interval() ;

	str = "TF="+NumToStr(tfsd/in1Minute, 1.0) + " P=" + NumToStr(period, 1.0)+"-"+ NumToStr(noiseperiod, 1.0);
	PlotText(str, BarCount+2, y, colorBlack) ;
}

showrib = ParamToggle("Show Ribbon", "No|Yes", 0) ;
barht = Param("Bar Ht", 4, 1, 100) ;

Refo = ParamField("Open", 0) ;
Refh = ParamField("High", 1) ;
Refl = ParamField("Low", 2) ;
Refc = ParamField("Close", 3) ;

if (showrib)
{
	Buy = Refc > Max(Refamaplotc, Refamaploth) ;
	Short = Refc < Min(Refamaplotc, Refamaplotl) ;

	up = Flip(Buy, Short) ;
	dn = Flip(Short, Buy) ;

	Clr = IIf(up, colorBlue, colorRed) ;

	Plot(barht, "", Clr, styleArea|styleNoLabel|styleOwnScale, 0, 100) ;
}

isemapvts = ParamToggle("Pvt Type", "H-L|EMA", 0) ;

if (tradearr)// AND NOT datamode)
{
avgP = (Refh+refl+Refc)/3 ;
p1 = Param("Fast", 1, 1, 100, 1) ;
p2 = Param("Slow", 3, 1, 100, 1) ;

ismph = H-H ;
ismpl = L-L ;
if (isemapvts)
{
EMA1 = EMA(avgP, p1) ;
EMA2 = EMA(avgP, p2) ;

upcross = Cross(EMA1, EMA2) ;
downcross = Cross(EMA2, EMA1) ;

bi = BarIndex() ; 

mphbar = HighestSinceBars(upcross, Refh) ;
mplbar = LowestSinceBars(downcross, Refl) ;

mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;

mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;

ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
}
else
{
	ismph = H >= Ref(H, -1) AND H > Ref(H, 1) ;
	ismpl = L <= Ref(L, -1) AND L < Ref(L, 1) ;
/*
	ismph = ExRem(ismph, ismpl) ;
	ismpl = ExRem(ismpl, ismph) ;
	isbmph = ExRem(isbmph, isbmpl) ;
	isbmpl = ExRem(isbmpl, isbmph) ;
*/

}


showminor = ParamToggle("Show Minor Pvts", "No|Yes", 1) ;
showminorlvls = ParamToggle("Show Minor Levels", "No|Yes", 1) ;

issquare = ParamToggle("Pvt style", "Circle|Square", 0) ;
pvtmarker = IIf(issquare, shapeSmallSquare, shapeSmallCircle) ;

if (showminor)
{
	PlotShapes(ismph*pvtmarker , colorRed, 0, Refh, 12) ;
	PlotShapes(ismpl*pvtmarker , colorGreen, 0, Refl, -12) ;
}

mph = ValueWhen(ismph, Refh) ;
mpl = ValueWhen(ismpl, Refl) ;

if (showminorlvls)
{
	x = LineArray(0, SelectedValue(mph), (BarCount-1), SelectedValue(mph));

	Plot(x, "", colorGold, styleDashed);

	x = LineArray(0, SelectedValue(mpl), (BarCount-1), SelectedValue(mpl));

	Plot(x, "", colorGold, styleDashed);
}


	Reflow = Refl ;
	Refhigh = Refh ;
	if (Onbody)
	{
		Reflow = Min(Refo, Refc) ;
		Refhigh = Max(Refo, Refc) ;
	}
	
	if (triggertypepvt)
	{
		Buy = ismph AND mph > AMAploth ;
		Short = ismpl AND mpl < AMAplotl ;
	}
	else
	{
		Buy = avgP > AMAploth ;
		Short = avgP < AMAplotl ;
	}

	Buy = ExRem(Buy, Short OR (C < AMAploth AND NOT C < AMAplotl ) ) ;
	Short = ExRem(Short, Buy OR C < (AMAplotl AND NOT C > AMAploth ) ) ;

	PlotShapes(Buy*shapeUpTriangle, colorGreen, 0, Refh, 12) ;
	PlotShapes(Short*shapeDownTriangle, colorBrown, 0, Refl, 12) ;
}
Sir

Along with excellent coding abilities , you have also excellent sharing abilities.
Hats off to you !!!
:clapping::clapping::clapping:
 

wisp

Well-Known Member
and similarly for positional

daily AMA on 15mn chart

green and brown trigger triangles

Pratap Sir, what is special about AMA? Wouldnt any higher tf MA do the same? Just trying to understand the difference..

4 hour 13 MA on 15 min chart below:

 

pratapvb

Well-Known Member
Pratap Sir, what is special about AMA? Wouldnt any higher tf MA do the same? Just trying to understand the difference..

4 hour 13 MA on 15 min chart below:

AMA is adaptive moving average as designed by Kauffman

it moves fast when there is a trend and moves slowly when there is a pb / sideways (no trend) price action
 

vikas2131

Well-Known Member
this is generic version of AMA AFL. by default it will show for the chart TF.

in param usetf = YES and tf = 1440 to get daily band for swing

tf = 15min for intraday

colors of band and MAs you can change suitably so that you can differentate which is intra and which swing :)

Code:
datamode = ParamToggle("Data Mode", "No|Yes", 0) ;
showintitle = ParamToggle("Show in Title", "No|Yes", 0) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;

usetf = ParamToggle("Use TF", "No|Yes", 0) ;
tf = Param("TF", 6, 1, 100000, 1) ;
isexpandLast = ParamToggle("Expand Mode", "First|Last", 1) ;
expandmode = IIf(isexpandLast, expandLast, expandFirst) ;

period = Param("Period", 30, 1, 100, 1) ;
noiseperiod = Param("Noise Period", 5, 1, 100, 1) ;
Clr = ParamColor("AMA Color", colorLightOrange) ;
ClrClose = ParamColor("AMA Close Color", colorOrange) ;

MAwidthper = Param("MA Width %", 0.005, 0, 10, 1) ;
MAwidth = SelectedValue(C) * MAwidthper /100 ;
showasband = ParamToggle("Show as band", "No|Yes", 1) ;
Onlyclose = ParamToggle("Show Only Close", "No|Yes", 0) ;
showclosebias = ParamToggle("Show Close Bias", "No|Yes", 0) ;
Closebiasht = Param("Close bias Ht", 4, 0, 100) ;
Clrbiasup = ParamColor("Color Bias Up", colorSkyblue) ;
Clrbiasdn = ParamColor("Color Bias Down", colorRose) ;
Clrbiasnone = ParamColor("Color Bias None", colorLavender) ;

Clrband = ParamColor("Color Band", colorGold) ;
bandlevel = Param("Level Band", -1, -5, 5, 1) ;
tradearr = ParamToggle("Show Trade Arrow", "No|Yes", 0) ;
triggertypepvt = ParamToggle("Trigger Type", "Bar|Pvt", 0) ;
Onbody= ParamToggle("BO style", "H-L|Body", 1) ;

datamodestyle = styleNoRescale ;
if (NOT showintitle)
	datamodestyle |= styleNoTitle ;
if (NOT showlabel)
	datamodestyle |= styleNoLabel ;

if (datamode)
	datamodestyle = styleNoDraw|styleNoTitle|styleNoLabel|styleNoRescale ;

onlyClosestyle = 0 ;
if (Onlyclose)
	OnlyClosestyle = styleNoDraw ;

tfs = tf *in1Minute ;
if (usetf)
	TimeFrameSet(tfs) ;

tfma = int(Interval()/60) ;
if (usetf AND tfs >= Interval())
	tfma = tf ;

strtf = NumToStr(tfma, 8.0)+"min" ;

Refo = ParamField("TF Open", 0) ;
Refh = ParamField("TF High", 1) ;
Refl = ParamField("TF Low", 2) ;
Refc = ParamField("TF Close", 3) ;
//Refbi = ParamField("BI", 4) ;

//Plot(EMA( Close, period ), "", colorRed) ;
fast = 2/(2+1);
slow = 2/(period+1);
dir=abs(Refc -Ref(Refc ,-noiseperiod ));
vol=Sum(abs(Refc -Ref(Refc,-1)),noiseperiod );
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2; 
amaplotcx = AMA( Refc, sc ); 

dirh=abs(Refh -Ref(Refh ,-noiseperiod ));
volh=Sum(abs(Refh -Ref(Refh,-1)),noiseperiod );
ERh=dirh/volh;
sch =( ERh*(fast-slow)+slow)^2; 
amaplothx = AMA( Refh, sch ); 

dirl=abs(Refl -Ref(Refl ,-noiseperiod ));
voll=Sum(abs(Refl -Ref(Refl,-1)),noiseperiod );
ERl=dirl/voll;
scl =( ERl*(fast-slow)+slow)^2; 
amaplotlx = AMA( Refl, scl ); 

	amaplotc = amaplotcx ;
	amaploth = amaplothx ;
	amaplotl = amaplotlx ;

if (usetf)
{
	amaplotc = TimeFrameExpand(amaplotcx, tfs, expandmode) ;
	amaploth = TimeFrameExpand(amaplothx, tfs, expandmode) ;
	amaplotl = TimeFrameExpand(amaplotlx, tfs, expandmode) ;

	TimeFrameRestore() ;
}

	showoncrb = ParamToggle("Show On CRB", "No|Yes", 0) ;
	Refo = ParamField("CRB Open", 7+0) ;
	Refh = ParamField("CRB High", 7+1) ;
	Refl = ParamField("CRB Low", 7+2) ;
	Refc = ParamField("CRB Close", 7+3) ;
	Refbi = ParamField("CRB BI", 7+4) ;
	Refcrbbars = ParamField("CRB Bars", 7+5) ;
	Refnbars = ParamField("TF Bars", 7+6) ;
	Refdt = ParamField("CRB DT", 7+7) ;


	if (showoncrb)
	{
		diffbars = Refnbars -Refcrbbars -1 ;

		// convert to crb
		Refamaploth = Ref(amaploth, -diffbars) ;
		Refamaplotc = Ref(amaplotc, -diffbars) ;
		Refamaplotl = Ref(amaplotl, -diffbars) ;

//		RefClre = Ref(Clr, -diffbars) ;

		k = 0 ;
		for ( i = Crbst ; i < BarCount ; i++)
		{
			Refbar = Refbi[i];

			Refamaploth[i] = amaploth[Refbar] ;
			Refamaplotc[i] = amaplotc[Refbar] ;
			Refamaplotl[i] = amaplotl[Refbar] ;

//			RefClre[i] = Clr[Refbar];
			k++;
		}
	}
	else
	{
		Refamaploth = amaploth ;
		Refamaplotc = amaplotc ;
		Refamaplotl = amaplotl ;
//		RefClre = Clre ;
	}


Plot(Refamaplotc, strtf+"AMA close"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), ClrClose, styleThick|datamodestyle) ;
Plot(Refamaploth, strtf+"AMA high"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle|OnlyClosestyle) ;
Plot(Refamaplotl, strtf+"AMA low"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle|OnlyClosestyle) ;
if (MAwidth > 0)
	PlotOHLC(Refamaplotc+MAwidth, Refamaplotc+MAwidth, Refamaplotc-MAwidth, Refamaplotc-MAwidth, "", ClrClose , styleCloud|styleNoLabel|datamodestyle) ;
if (showasband)
{
	PlotOHLC(Refamaploth, Refamaploth, Refamaplotl, Refamaplotl, "", Clrband, styleCloud|styleNoLabel|datamodestyle|OnlyClosestyle, 0, 0, 0, bandlevel) ;
}

if (showclosebias)
{
	upside = Refamaploth-(Refamaploth-Refamaplotl)/3 ;
	dnside = Refamaplotl+(Refamaploth-Refamaplotl)/3 ;

	up = Refamaplotc >= upside ;
	dn = Refamaplotc <= dnside ;

	Clr = IIf(up, Clrbiasup, IIf(dn, Clrbiasdn,Clrbiasnone)) ;

	Plot(Closebiasht, "", Clr, styleArea|styleNoLabel|styleOwnScale, 0, 100) ;
}

showparam = ParamToggle("Show Key Param", "No|Yes", 0) ;

if (showparam)
{
	y = (SelectedValue(Refamaploth)+ SelectedValue(Refamaplotl)) /2 ;
	tfsd = tfs ;
	if (tfsd < Interval())
		tfsd = Interval() ;

	str = "TF="+NumToStr(tfsd/in1Minute, 1.0) + " P=" + NumToStr(period, 1.0)+"-"+ NumToStr(noiseperiod, 1.0);
	PlotText(str, BarCount+2, y, colorBlack) ;
}

showrib = ParamToggle("Show Ribbon", "No|Yes", 0) ;
barht = Param("Bar Ht", 4, 1, 100) ;

Refo = ParamField("Open", 0) ;
Refh = ParamField("High", 1) ;
Refl = ParamField("Low", 2) ;
Refc = ParamField("Close", 3) ;

if (showrib)
{
	Buy = Refc > Max(Refamaplotc, Refamaploth) ;
	Short = Refc < Min(Refamaplotc, Refamaplotl) ;

	up = Flip(Buy, Short) ;
	dn = Flip(Short, Buy) ;

	Clr = IIf(up, colorBlue, colorRed) ;

	Plot(barht, "", Clr, styleArea|styleNoLabel|styleOwnScale, 0, 100) ;
}

isemapvts = ParamToggle("Pvt Type", "H-L|EMA", 0) ;

if (tradearr)// AND NOT datamode)
{
avgP = (Refh+refl+Refc)/3 ;
p1 = Param("Fast", 1, 1, 100, 1) ;
p2 = Param("Slow", 3, 1, 100, 1) ;

ismph = H-H ;
ismpl = L-L ;
if (isemapvts)
{
EMA1 = EMA(avgP, p1) ;
EMA2 = EMA(avgP, p2) ;

upcross = Cross(EMA1, EMA2) ;
downcross = Cross(EMA2, EMA1) ;

bi = BarIndex() ; 

mphbar = HighestSinceBars(upcross, Refh) ;
mplbar = LowestSinceBars(downcross, Refl) ;

mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;

mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;

ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
}
else
{
	ismph = H >= Ref(H, -1) AND H > Ref(H, 1) ;
	ismpl = L <= Ref(L, -1) AND L < Ref(L, 1) ;
/*
	ismph = ExRem(ismph, ismpl) ;
	ismpl = ExRem(ismpl, ismph) ;
	isbmph = ExRem(isbmph, isbmpl) ;
	isbmpl = ExRem(isbmpl, isbmph) ;
*/

}


showminor = ParamToggle("Show Minor Pvts", "No|Yes", 1) ;
showminorlvls = ParamToggle("Show Minor Levels", "No|Yes", 1) ;

issquare = ParamToggle("Pvt style", "Circle|Square", 0) ;
pvtmarker = IIf(issquare, shapeSmallSquare, shapeSmallCircle) ;

if (showminor)
{
	PlotShapes(ismph*pvtmarker , colorRed, 0, Refh, 12) ;
	PlotShapes(ismpl*pvtmarker , colorGreen, 0, Refl, -12) ;
}

mph = ValueWhen(ismph, Refh) ;
mpl = ValueWhen(ismpl, Refl) ;

if (showminorlvls)
{
	x = LineArray(0, SelectedValue(mph), (BarCount-1), SelectedValue(mph));

	Plot(x, "", colorGold, styleDashed);

	x = LineArray(0, SelectedValue(mpl), (BarCount-1), SelectedValue(mpl));

	Plot(x, "", colorGold, styleDashed);
}


	Reflow = Refl ;
	Refhigh = Refh ;
	if (Onbody)
	{
		Reflow = Min(Refo, Refc) ;
		Refhigh = Max(Refo, Refc) ;
	}
	
	if (triggertypepvt)
	{
		Buy = ismph AND mph > AMAploth ;
		Short = ismpl AND mpl < AMAplotl ;
	}
	else
	{
		Buy = avgP > AMAploth ;
		Short = avgP < AMAplotl ;
	}

	Buy = ExRem(Buy, Short OR (C < AMAploth AND NOT C < AMAplotl ) ) ;
	Short = ExRem(Short, Buy OR C < (AMAplotl AND NOT C > AMAploth ) ) ;

	PlotShapes(Buy*shapeUpTriangle, colorGreen, 0, Refh, 12) ;
	PlotShapes(Short*shapeDownTriangle, colorBrown, 0, Refl, 12) ;
}
Great work..thank you :)
 

wisp

Well-Known Member
AMA is adaptive moving average as designed by Kauffman

it moves fast when there is a trend and moves slowly when there is a pb / sideways (no trend) price action
Investopedia has this to say about Adaptive Averages:

Robert Colby tested hundreds of technical-analysis tools in The Encyclopedia of Technical Market Indicators. He concluded, "Although the adaptive moving average is an interesting newer idea with considerable intellectual appeal, our preliminary tests fail to show any real practical advantage to this more complex trend smoothing method." This doesn't mean traders should ignore the idea. The AMA could be combined with other indicators to develop a profitable trading system. (For more on this topic, read Discovering Keltner Channels And The Chaikin Oscillator.)
 

pratapvb

Well-Known Member
Investopedia has this to say about Adaptive Averages:

Robert Colby tested hundreds of technical-analysis tools in The Encyclopedia of Technical Market Indicators. He concluded, "Although the adaptive moving average is an interesting newer idea with considerable intellectual appeal, our preliminary tests fail to show any real practical advantage to this more complex trend smoothing method." This doesn't mean traders should ignore the idea. The AMA could be combined with other indicators to develop a profitable trading system. (For more on this topic, read Discovering Keltner Channels And The Chaikin Oscillator.)
he may be referring to just AMA of close

I found this modification of using a band created by AMA of high and low useful.... it does not lag too much ... holds the trend when there is a trend and gives potential sideways region i.e. the
band (with AMA of high and low)

so the trade entry is not too late nor too early etc

and last but not the least it is making me money after lot of other R&D. of course I do use s/rs like 2day and 5day vwap levels ... noise band around open etc
 

Similar threads