Dear Friends,
Can someone correct this useful AFL so as to run proper EMA lines...???
I'm not sure "PREV" is the correct variable for the AFL....
Waiting for your great contribution....
Thanks in advance....
*************************************************
_SECTION_BEGIN("Power Moving Averages");
P1 = Param("EMA Periods1", 9, 2, 200, 1);
Pr=(H+L+2*C)/4;
MA1=TEMA(Pr,P1);
Shift=round(P1/2);
center=LastValue(Shift);
CMA=Ref(MA1,center);
y=LastValue(CMA+PREV-PREV);
CMA=IIf(y>0,y,Pr);
CMA1= Ref(TEMA(Pr,P1-1),center-1)
y=LastValue(CMA1+PREV-PREV);
CMA1=IIf(y>0,y,Pr);
CMA2= Ref(TEMA(Pr,P1-2),center-2)
y=LastValue(CMA2+PREV-PREV);
CMA2=IIf(y>0,y,Pr);
CMA3= Ref(TEMA(Pr,P1-3),center-3)
y=LastValue(CMA3+PREV-PREV);
CMA3=IIf(y>0,y,Pr);
CMA4= Ref(TEMA(Pr,P1-4),center-4)
y=LastValue(CMA4+PREV-PREV);
CMA4=IIf(y>0,y,Pr);
CMA5= Ref(TEMA(Pr,P1-5),center-5)
y=LastValue(CMA5+PREV-PREV);
CMA5=IIf(y>0,y,Pr);
CMAP=
IIf(Cum(1)=LastValue(Cum(1)-center+1),CMA1,
IIf(Cum(1)=LastValue(Cum(1)-center+2),CMA2,
IIf(Cum(1)=LastValue(Cum(1)-center+3),CMA3,
IIf(Cum(1)=LastValue(Cum(1)-center+4),CMA4,
IIf(Cum(1)=LastValue(Cum(1)-center+5),CMA5,CMA)))));
K=CMAP;
K1=EMA(K,4);
Plot(K,"",colorGreen,Styline);
Plot(K1,"",colorRed,Styline);
_SECTION_END();
Can someone correct this useful AFL so as to run proper EMA lines...???
I'm not sure "PREV" is the correct variable for the AFL....
Waiting for your great contribution....
Thanks in advance....
*************************************************
_SECTION_BEGIN("Power Moving Averages");
P1 = Param("EMA Periods1", 9, 2, 200, 1);
Pr=(H+L+2*C)/4;
MA1=TEMA(Pr,P1);
Shift=round(P1/2);
center=LastValue(Shift);
CMA=Ref(MA1,center);
y=LastValue(CMA+PREV-PREV);
CMA=IIf(y>0,y,Pr);
CMA1= Ref(TEMA(Pr,P1-1),center-1)
y=LastValue(CMA1+PREV-PREV);
CMA1=IIf(y>0,y,Pr);
CMA2= Ref(TEMA(Pr,P1-2),center-2)
y=LastValue(CMA2+PREV-PREV);
CMA2=IIf(y>0,y,Pr);
CMA3= Ref(TEMA(Pr,P1-3),center-3)
y=LastValue(CMA3+PREV-PREV);
CMA3=IIf(y>0,y,Pr);
CMA4= Ref(TEMA(Pr,P1-4),center-4)
y=LastValue(CMA4+PREV-PREV);
CMA4=IIf(y>0,y,Pr);
CMA5= Ref(TEMA(Pr,P1-5),center-5)
y=LastValue(CMA5+PREV-PREV);
CMA5=IIf(y>0,y,Pr);
CMAP=
IIf(Cum(1)=LastValue(Cum(1)-center+1),CMA1,
IIf(Cum(1)=LastValue(Cum(1)-center+2),CMA2,
IIf(Cum(1)=LastValue(Cum(1)-center+3),CMA3,
IIf(Cum(1)=LastValue(Cum(1)-center+4),CMA4,
IIf(Cum(1)=LastValue(Cum(1)-center+5),CMA5,CMA)))));
K=CMAP;
K1=EMA(K,4);
Plot(K,"",colorGreen,Styline);
Plot(K1,"",colorRed,Styline);
_SECTION_END();