PureBytes Links
Trading Reference Links
|
Thanks for the help.
--- In amibroker@xxxxxxxxxxxxxxx, "Mohan Yellayi <yellayi@xxxx>"
<yellayi@xxxx> wrote:
> Anthony put one in the AFL Library
> http://www.amibroker.com/library/
>
> Here it is again. I changed period to paramaters
>
>
> //Triangular Moving average
> //Anthony Faragasso
> //December, 2002
>
> /* A Triangular moving average is similar to exponential AND
> weighted moving averages except A different weighting scheme
> is used. Exponential AND Weighted averages assign the majority
> of the weight to the most recent data. Simple moving averages
> assign the weight equally across all the data. With A Triangular
> moving average, the majority of the weight is assigned to the middle
> portion of the data.*/
>
> Odd=Param("Period",13,1,120,1);//enter Odd numbers only
> CoefOdd=round(Odd/2);
>
> Even=Odd-1; //12;//enter Even numbers only
> Coefeven=Even/2;
> Coefeven2=Coefeven+1;
>
> CongestionPercent=2.8;/*Set % above/below Moving average for
> congestion / sideways market*/
>
> TriangularOdd=MA(MA(C,CoefOdd),CoefOdd);
> TriangularEven=MA(MA(C,Coefeven),Coefeven2);
>
> finalMov_avg=IIf(Odd > even,triangularOdd,TriangularEven);
>
> Color=colorBrightGreen;//select Moving average line color
> tickercolor=colorWhite;//select price color
>
> Plot(finalMov_avg,"",IIf(C <
> finalmov_avg,colorRed,Color),styleLine|styleThick);
> Plot(C,"",tickercolor,styleCandle);
>
> Title=Name()+"..."+"( "+WriteIf(Odd > even,WriteVal(Odd,1),WriteVal
> (even,1))+" ) Period "+EncodeColor(Color)+"Triangular"+WriteIf(Odd
>
> even,"ODD","EVEN")+" Moving Average"+"..."+EncodeColor(colorBlack)+
> WriteIf(C < finalMov_avg,"Close is "+EncodeColor(colorRed)
> +"Below"+EncodeColor(colorBlack)+" Moving Average by ","Close
> is"+EncodeColor(colorBrightGreen)+" Above"+EncodeColor(colorBlack)
+"
> Moving Average by ")+"("+WriteVal(((C/finalMov_avg)-1)*100,1.1)
> +"% )"+"\n"+WriteIf(finalmov_avg-Ref(finalmov_avg,-1)>0," Slope Of
> Average is UP : ","Slope Of Average is DOWN :")+WriteIf
> ((((C/finalMov_avg)-1)*100 <= CongestionPercent AND
> ((C/finalMov_avg)-1)*100 >= -CongestionPercent),EncodeColor
> (colorYellow)+" with Price Congestion / Divergence to Average ","")
> +"\n"+WriteIf(Ref(C,-1) < Ref(finalmov_avg,-1) AND C >
> finalmov_avg,EncodeColor(colorGreen)+"Possible Change in Trend From
> Down to Up"+"\n"+" OR Short Term Correction of Previous
> Trend",WriteIf(Ref(C,-1) > Ref(finalmov_avg,-1) AND C <
> finalmov_avg,EncodeColor(colorRed)+"Possible Change in Trend From
Up
> to Down "+"\n"+" OR Short Term Correction to Previous Trend",""))
> +"\n"+WriteIf(C > finalmov_avg,EncodeColor(colorGreen)+"Close has
> been above Moving Average ( "+WriteVal(BarsSince(C <
finalmov_avg),1)
> +" ) Bars",EncodeColor(colorRed)+"Close has been Below Moving
> Average ( "+WriteVal(BarsSince(C > finalmov_avg),1)+" ) Bars")
> +"\n"+EncodeColor(colorBlack)+"The average # of Bars Above
> ( "+WriteVal(round(Cum(BarsSince(C < finalmov_avg)/Cum(1))),1)
> +" )"+"\n"+"The average # of Bars Below ( "+WriteVal(round(Cum
> (BarsSince(C > finalmov_avg)/Cum(1))),1)+" )";
>
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "n7wyw <dennisljohnston@xxxx>"
> <dennisljohnston@xxxx> wrote:
> > I'd like to try this moving average. Has anyone created afl for
> this
> > one?
> >
> > "Triangular Moving Average - The triangular moving average
derives
> > its name from the way the weighting factors are applied to the un
> > smoothed data. For example, for a 7 period moving average, the
> > weighting factors are 1, 2, 3, 4, 3, 2, 1."
> >
> >
> > I found some coding in another system:
> >
> > !Triangle Moving Average
> >
> > define periods 9.
> > value is [close].
> > midpt is (floor(periods/2)+1).
> > weight is iff(days > midpt, midpt - (days - midpt), days).
> >
> > ! For RT Alerts uncomment this next line.
> > !days is ReportDate() - RuleDate() + 1.
> >
> > ! For EDS uncomment this line
> > days is OffsetToDate(Month(),Day(),Year()) + 1.
> > sumweights is sum(weight,periods). workval is weight * valresult
> > (value,days-1).
> > sumval is sum(workval,periods).
> >
> > TMA is sumval/sumweights.
> >
> > Thanks in advance for any insights
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|