merhaba,
görebildiğimiz if blogunda hata vardı
Periods:=Input("Time Periods",1,1000,10);
Direction:=CLOSE-Ref(CLOSE,-periods);
Volatility:=Sum(Abs(ROC(CLOSE,1,$)),periods);
ER:=Abs(Direction/Volatility);
FastSC:=2/(2+1);
SlowSC:=2/(30+1);
SSC:=ER*(FastSC-SlowSC)+SlowSC;
Constant:=Pwr(SSC,2);
AMA:=If(Cum(1)=periods+1,Ref(CLOSE,-1)+constant*(CLOSE-Ref(CLOSE,-1)),PREV+constant*(CLOSE-PREV));
FilterPercent:=Input("Filter Percentage",0,100,15)/100;
Filter:=FilterPercent*Std(AMA-Ref(AMA,-1),Periods);
AMALow:=If(AMA<Ref(AMA,-1),AMA,PREV);
AMAHigh:=If(AMA>Ref(AMA,-1),AMA,PREV);
If(AMA-AMALow>Filter,1{Buy Signal},0);
If(AMAHigh-AMA>Filter,-1{Sell Signal},0{No_Signal})
şeklinde düzelttik KAMA olarak aşağıdaki gib i kullanabilirsiniz,
bir deneyip inceleyiniz,
periods:=10;
periods2:=2;
periods3:=30;
Pds:=Periods+1;
FastSC:=2/(periods2+1);
SlowSC:=2/(periods3+1);
{Kaufman Adaptive Moving Average}
Direction:=Abs(C-Ref(C,-periods));
Volatility:=Sum(Abs(C-REF(C,-1)),periods);
ER:=Direction/Volatility;
SSC:=ER*(FastSC-SlowSC)+SlowSC;
Constant:= POWER(SSC,2);
KAMA:=If(Cum(1) = Pds,Ref(C,-1)+Constant*(C-Ref(C,-1)),PREV+Constant*(C-PREV));
KAMA