You are right, my datas are broken somewhere. It works on other contract. Thank you for the solution. I keep that in mind.
Regards --- In [email protected], [EMAIL PROTECTED] wrote: > > It works for me. Did you change the symbol and try? There could be something wrong with your data for that symbol. Try on an index - CAC40 for example. > > -------------- Original message ---------------------- > From: "reinsley" <[EMAIL PROTECTED]> > > > > > > I put the thing in another way, and the plot says " kama = {NAN} > > Periods=14 " > > > > The result of the AMA2 is not a number. The trace of the variables > > shows kama=0. > > > > After a click into the graphic the calculation is ok, I see " kama = > > 4961.542 Periods=14 " > > Or if I hoover the mouse on the graph then calculation runs slowly > > for few bars. > > > > Something goes wrong with ama2 fields. However it looks like the help > > example. > > How can I obtain a number as result of AMA2 ? > > If somebody could test and correct the following code ? > > > > // Kauffman AMA > > > > GraphXSpace=2; > > > > T1=Param("Period",14,5,25,1); //Periods > > _TRACE("T1 = "+T1); > > V2=Param("Fast",2,2,20,1); //fast > > _TRACE("V2 = "+V2); > > V3=Param("Slow",30,15,50,1); //slow > > _TRACE("V3 = "+V3); > > F1=2/(V2+1); > > _TRACE("F1 = "+F1); > > S1=2/(V3+1); > > _TRACE("S1 = "+S1); > > dir=abs(C-(Ref(C,-T1))); > > _TRACE("dir = "+dir); > > Vol=Sum(abs(C-(Ref(C,-1))),T1); > > _TRACE("vol = "+Vol); > > ER=dir/Vol; //(C-(Ref(C,-T1)))/Sum(abs(C-(Ref(C,-1))),T1)); > > _TRACE("ER = "+ER); > > A1=ER*(F1-S1)+S1; > > _TRACE("A1 = "+A1); > > A2=A1^2; > > _TRACE("A2 = "+A2); > > > > KAMA=AMA2(Close,A2,1-A2); > > _TRACE("kama = "+kama); > > > > Title="KAMA2 = " + WriteVal(KAMA) + " Periods=" + WriteVal(T1,1.0); > > > > > > Plot(KAMA,"KAMA",colorRed, styleLine); > > // Plot(T1,"Periods",0,16); > > Title="KAMA2 = " + WriteVal(KAMA) + " Periods=" + WriteVal(T1,1.0); > > > > /////////////////Plot Price////////////////////// > > Plot(C,"close",6,128); > > //_N(Title = "KAMA - "+StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} > > Open %g, Hi %g, Lo %g, Cl %g {{VALUES}}", O, H, L ,C )); > > > > > > > > > > Thank you for debug. > > > > Regards > > > > > > > > > > > > > > > > > > > > --- In [email protected], "reinsley" <reinsley@> wrote: > > > > > > Hello, > > > > > > I meet a difficulty to plot a Kaufman AMA function from AB menu Charts > > > | Averages > > > > > > I installed two AFL scripts as follows. > > > > > > I created,with notepad, a function that is saved in dir C:\Program > > > Files\AmiBroker\Formulas\Include\KamaFunction.afl > > > > > > function KamaFunction(P,periods,fast,slow) > > > { > > > T1=periods; > > > V2=fast; > > > V3=Slow; > > > F1=2/(V2+1); > > > S1=2/(V3+1); > > > ER=(abs(P-Ref(P,-T1))/Sum(abs(P-Ref(P,-1)),T1)); > > > A1=ER*(F1-S1)+S1; > > > A2=A1^2; > > > kama = AMA2(P,A2,1-A2); > > > return kama; > > > } > > > > > > > > > I created,with notepad, an afl that is saved in dir C:\Program > > > Files\AmiBroker\Formulas\Averages\KAMA - Kaufman Adaptive Moving > > > Average.afl > > > > > > #include_once<KamaFunction.afl> > > > P = ParamField("Price field",-1); > > > Periods = Param("Periods", 14, 2, 200, 1, 10 ); > > > fast = Param("Fast", 2, 2, 200, 1, 10 ); > > > slow = Param("Slow", 30, 2, 200, 1, 10 ); > > > Plot(KamaFunction( P, Periods, fast, slow ), _DEFAULT_NAME(), > > > ParamColor( "Color", colorCycle ), ParamStyle("Style") ); > > > > > > When I insert or overlay from Charts | Average, the KAMA simple plot > > > on the close does not appear until I click on to the chart. Then the > > > plot appears instantly. > > > > > > Another annoying thing, the AA backtest does not run a trading system > > > that use the KamaFunction. > > > > > > I implanted a Hull MA and a T3 MA the same way, both are plotted > > > without click and the respectives functions are recognized by > > backtester. > > > > > > I would appreciate any help to find the tiny blocking point, my ideas > > > ran out... > > > > > > Regards > > > > > > > > > >
