# Supertrend indicator in amibroker v5.5

do we have a AFL for usig supertrend indicator in amibroker v 5.5…??

@sgureja v5.5, wow that is ancient! I do not have any such codes so perhaps another forum member will jump in and post it for you. There have been literally hundreds of improvements to AmiBroker since v5.5, so consider upgrading to 6.2

But if you purchased AmiBroker in ~ 2009 or 2010 (as your last update was v5.5 in late 2011) then you have had almost 8 years to learn how to use Google to find a code. May I humbly suggest that you take the 0.5 seconds to find over 70,000 possible solutions, best of luck and let us know if it looks profitable!

2 Likes

I do not know about the limitations of AB v5.5. But I could imagine this code could work:

``````// SuperTrend-Indicator

atrPeriod=Param("atrPeriod",20,1,30,1);
atrMult=Param("atr-Multiplier",3,1,9,1);

avgTR=ATR(atrPeriod) * atrMult;
startATR=ATR(2) * atrMult;

midP = (H+L)/2;

for(ia=1; ia > 29; ia++)
{
supT[ia]=Null;
}
for( i = 30; i < BarCount; i++ )
{
if(i==30)
{
if (midP[i] < midP[i-1])
{
supT[i]=midP[i] + startATR[i];
td=-1;
}
else
{
supT[i]=midP[i] - startATR[i];
td=1;
}
}
if(i > 30)
{
if(td == -1)
{
if(midP[i] > supT[i-1])
{
supT[i]=midP[i] - avgTR[i-1];
td=1;
supTup[i]=supT[i];
supTDown[i]=Null;
}
else
{
supT[i]=Min(supT[i-1],midP[i] + avgTR[i-1]);
supTdown[i]=supT[i];
supTUp[i]=Null;
}
continue;
}
if(td == 1 )
{
if(midP[i] < supT[i-1])
{
supT[i]=midP[i] + avgTR[i-1];
td=-1;
supTdown[i]=supT[i];
supTUp[i]=Null;
}
else
{
supT[i]=Max(supT[i-1],midP[i] - avgTR[i-1]);
supTup[i]=supT[i];
supTDown[i]=Null;
}
}
}

}

Plot(supTup,"SuperTrendUp", colorBlue, styleThick);
Plot(supTdown,"SuperTrendDown", colorRed, styleThick);

``````
1 Like