Skip to main content

TMA BANDS for Amibroker (AFL)

anandnst over 13 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 4)
  • Tags:
    amibroker

This is Triangular Moving Average (TMA) Bands Which i got from a forum n felt like sharing with u for Tops n bottoms.

Test them ..Comments are welcome

Author: KelvinHand at http://www.traderji.com/amibroker/74960-triangular-moving-average-tma-bands.html

Thnx you in advance.

Regards

Anandnst@gmail.com

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("TMA");
HalfLength      = Param("HalfLength", 61, 1, 999);
ATRPeriod       = Param("ATRPeriod", 110,1,1000);

ATRMultiplier1   = Param("ATR Multiplier 1", 1.8);
ATRMultiplier2   = Param("ATR Multiplier 2", 2.2);
ATRMultiplier3   = Param("ATR Multiplier 3", 2.6);

ATRMultiplier4   = Param("ATR Multiplier 4", 3.0);
ATRMultiplier5   = Param("ATR Multiplier 5", 3.4);
ATRMultiplier6   = Param("ATR Multiplier 6", 3.8);

ATRMultiplier7   = Param("ATR Multiplier 7", 4.2);
ATRMultiplier8   = Param("ATR Multiplier 8", 4.6);
ATRMultiplier9   = Param("ATR Multiplier 9", 5.0);


cMidB = ParamColor("Mid Band", colorGreen);
cUprB = ParamColor("Upper Band", colorRed);
cLwrB = ParamColor("Lower Band", ColorRGB(30,144,255));

HalfLength=Max(HalfLength,1);

midBand = Null;

 p = Close;
 sma = MA(P, 1);
 iatr= ATR(ATRPeriod);

 iLmt = BarCount-1 - (HalfLength);
  
 for (i=0; i<BarCount; i++)
 {
 
    dSum = (HalfLength+1)* sma[i];
    sumw = (HalfLength+1);
         
    for(j=1, k=HalfLength; j<=HalfLength; j++, k--)
    {
        if(i+j>=BarCount) break;

        dSum  += k* sma[i+j];
        sumw += k;

        if (j<=i)
        {
          dSum  += k*sma[i-j];
          sumw += k;
        }
    }

    MidBand[i] = dSum/sumw;
          
 }

 UprBand1 = MidBand+iATR*ATRMultiplier1;
 LwrBand1 = MidBand-iATR*ATRMultiplier1;

 UprBand2 = MidBand+iATR*ATRMultiplier2;
 LwrBand2 = MidBand-iATR*ATRMultiplier2;

 UprBand3 = MidBand+iATR*ATRMultiplier3;
 LwrBand3 = MidBand-iATR*ATRMultiplier3;


 UprBand4 = MidBand+iATR*ATRMultiplier4;
 LwrBand4 = MidBand-iATR*ATRMultiplier4;

 UprBand5 = MidBand+iATR*ATRMultiplier5;
 LwrBand5 = MidBand-iATR*ATRMultiplier5;

 UprBand6 = MidBand+iATR*ATRMultiplier6;
 LwrBand6 = MidBand-iATR*ATRMultiplier6;


 UprBand7 = MidBand+iATR*ATRMultiplier7;
 LwrBand7 = MidBand-iATR*ATRMultiplier7;

 UprBand8 = MidBand+iATR*ATRMultiplier8;
 LwrBand8 = MidBand-iATR*ATRMultiplier8;

 UprBand9 = MidBand+iATR*ATRMultiplier9;
 LwrBand9 = MidBand-iATR*ATRMultiplier9;

Plot(MidBand, "MidBand",  cMidB, styleNoLabel|styleNoTitle);

Plot(UprBand1, "UprBand1", cUprB, styleNoLabel|styleNoTitle);
Plot(LwrBand1, "LwrBand1", cLwrB, styleNoLabel|styleNoTitle);

Plot(UprBand2, "UprBand2", cUprB, styleNoLabel|styleNoTitle|styleBar);

Plot(LwrBand2, "LwrBand2", cLwrB, styleNoLabel|styleNoTitle|styleBar);

Plot(UprBand3, "UprBand3", cUprB, styleNoLabel|styleNoTitle|styleBar);
Plot(LwrBand3, "LwrBand3", cLwrB, styleNoLabel|styleNoTitle|styleBar);


Plot(UprBand4, "UprBand4", cUprB, styleNoLabel|styleNoTitle|styleBar);
Plot(LwrBand4, "LwrBand4", cLwrB, styleNoLabel|styleNoTitle|styleBar);


Plot(UprBand5, "UprBand5", cUprB, styleNoLabel|styleNoTitle|styleBar);
Plot(LwrBand5, "LwrBand5", cLwrB, styleNoLabel|styleNoTitle|styleBar);


Plot(UprBand6, "UprBand6", cUprB, styleNoLabel|styleNoTitle|styleBar);
Plot(LwrBand6, "LwrBand6", cLwrB, styleNoLabel|styleNoTitle|styleBar);


Plot(UprBand7, "UprBand7", cUprB, styleNoLabel|styleNoTitle);
Plot(LwrBand7, "LwrBand7", cLwrB, styleNoLabel|styleNoTitle);

Plot(UprBand8, "UprBand8", cUprB, styleNoLabel|styleNoTitle|styleThick);
Plot(LwrBand8, "LwrBand8", cLwrB, styleNoLabel|styleNoTitle|styleThick);

Plot(UprBand9, "UprBand9", cUprB, styleNoLabel|styleNoTitle|styleThick);
Plot(LwrBand9, "LwrBand9", cLwrB, styleNoLabel|styleNoTitle|styleThick);
_SECTION_END();

/*Plot Ribbon */
Ribbon1=IIf( EMA( Close , 7 )>EMA( Close , 21 ) ,colorGreen, IIf(EMA( Close , 34 )>EMA( Close , 8 ), colorRed,colorYellow));
Plot(6, "Ribbon", Ribbon1, styleOwnScale| styleArea| styleNoLabel,-0.5,100);
_SECTION_END();

12 comments

2. hotaro3
over 13 years ago

there is triangular moving average in indicators library here with better results specially for selling point

over 13 years ago

hi Anand ,

ur TMA afl is good , iam combined this afl with my Exellent Trend Catching Indicator afl, it seems exellent results, but some problems there, that prpblems iam sending u by email, pls chek it try to correction,

thank u
krishna_vaastu@yahoo.com

over 13 years ago

This AFL script was done by me KelvinHand in http://www.traderji.com/amibroker/74960-triangular-moving-average-tma-bands.html

Although it is in public forum. It should be courtesy to point out the Author who created it.

Not that you just grab (stealing) the whole thing and put it under your name and let whole world think that you are the owner.

6. vabsy
over 13 years ago

hello sir, alf is very nice but i am facing some problems
defficult to identify support or resistance how can find out?

over 13 years ago

finally Some real code owner caught u Mr. anandst “the so called coder”
even i tried to make u aware of wht ur doing.
but didn’t changed.
u r doing good job but not mentioning the author’s name and not giving him the credit is really bad habit u got

i totally agree with u Kelvinhand.

And anand this site owner made good provision to give stars to the codes u like so there is no need to give stars publicly.
u r just acting like a watch dog of wisestocktrader.

if u can not create ur own code u must not comment hard on somebody’s real own work though this is a public site.

over 13 years ago

Hello KelvinHand,

I do respect ur hard work but i never told its my coding.(NO WRONG INTENSIONS)

(This is Triangular Moving Average (TMA) Bands Which i got from a forum n felt like sharing with u for Tops n bottoms).

Please read above – i got from a forum n felt like sharing with wisestocktrader people.

Well i thought its not legal to share link of other forum so i havnt shared link of traderji. Now i got to know abt it.

Well extremist,

I havnt seen any negative person then you. When u r posting something in forum , u should be ready to recieve comments.
Take everything in positive way n try to improve by suggestions.
I have seen who ever commented on ur 4 Contributions u have reacted like anything. Better stop posting n commenting on others if u cant take things in positive way.

( I have no intensions to hurt anyone but surely ur words hurting others).

Thanx you & Happy Diwali

over 13 years ago

Sir I am Using Ami 5.5 But Not Working Sir pls help Me…………..
By Elango Tirupur..

10. atinshah
over 13 years ago

HELLLO

TRIPUR ELONGO

YOR PROBLEM IS : Using Ami 5.5 But Not Working………

MAIL ME I WILL SEND YOU A SET UP

atinshah@gmail.com

almost 2 years ago

hi kelvinhand my name is claudio, I would like import this indicator in ninjatrader 8, but I can’t see the winrar(winzip) do you possible help me please,i dont now used the script in ninjatrader(hehe) thanks a lot brother.

almost 2 years ago

HI GUYS, WHO CAN PLEASE HELP ME TO DOWNLOAD THE INDICATOR IN WINZIP OR WINRAR, I WOULD LIKE TO TEST THE INDICATOR, THANKS A LOT .

Leave Comment

Please login here to leave a comment.