# Can someone help me to convert from Metastock to Amibroker

#### Jacare

##### New Member
Hi,

Can someone help me to convert from Metastock to Amibroker? This is a Supertrend, I found here in this Forum some similar translations, but they aren't the same. I tried and compared a lot of them.

Factor:=Input("Factor",1.00,10.00,3.00);
Pd:=Input("ATR Periods",1,100,10);
Up:=MP()+(Factor*ATR(Pd));
Dn:=MP()-(Factor*ATR(Pd));
Td:=If(Cross(C,LLV(Up,13)),1,If(Cross(HHV(Dn,13),C),-1,PREV));
Dnx:=If(Dn=HighestSince(1,Cross(Td,0),Dn),Dn,PREV);
Upx:=If(Up=LowestSince(1,Cross(0,Td),Up),Up,PREV);
ST:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
ST

Thanks in advance!

Cheers,

Jacare

#### cas67

##### New Member
Here
pls cross check with MS.
you may need to adjust parameters
*Author of this formula = Edward Pottash

_SECTION_BEGIN("ST");
Factor=Param("Factor",2,1,5,0.5);
Pd=Param("ATR Periods",10,1,100,1);
Pda=Param("Look back",13,1,50,1);
Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));

aa=Cross(C,LLV(Up,pda));
bb=Cross(HHV(Dn,pda),C);
Td[0]=1;
for(i=1;i<BarCount;i++ )
{
prev=Td[i-1];
if(aa)
{
Td=1;
}
else if(bb)
{
Td=-1;
}
else
{
Td=prev;
}
}
aa=Dn==HighestSince(Cross(Td,0),Dn);
Dnx=Dn[0];
for(i=1;i<BarCount;i++ )
{
prev=Dnx[i-1];
if(aa)
{
Dnx=Dn;
}
else
{
Dnx=prev;
}
}
aa=Up==LowestSince(Cross(0,Td),Up);
Upx=Up[0];
for(i=1;i<BarCount;i++ )
{
prev=Upx[i-1];
if(aa)
{
Upx=Up;
}
else
{
Upx=prev;
}
}
//ST:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
aa=Td==1;
bb=Td==-1;
ST[0]=1;
for(i=1;i<BarCount;i++ )
{
prev=ST[i-1];
if(aa)
{
ST=Dnx;
}
else if(bb)
{
ST=Upx;
}
else
{
ST=prev;
}
}
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0,0)));
SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);
Plot(ST,"",colorTan,styleLine);
Thank you

#### Jacare

##### New Member
Great! It looks perfect!! Thank you very much! :thumb:

Jacare

#### Jacare

##### New Member
Hey cas67,

I noticed that you did the formula together with the price. Could it be possible to have the indicator only, where can I put it in another existing chart? I use this indicator 3 times in the same chart, with differents parameters.

Thanks again!
Jacare

#### pra1968

##### Member
How to use it

can someone put buy sell signal in it

#### Jacare

##### New Member
Could it be possible to have the indicator only, where can I put it in another existing chart? I use this indicator 3 times in the same chart, with differents parameters.

Thanks again!
Jacare

#### velmont86

##### Active Member
Could it be possible to have the indicator only, where can I put it in another existing chart? I use this indicator 3 times in the same chart, with differents parameters.

Thanks again!
Jacare

so simple just remove this line
Plot(C,"",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

#### MOHHMED SALEH

##### New Member
_SECTION_BEGIN("ST");
Factor=Param("Factor",2,1,5,0.5);
Pd=Param("ATR Periods",10,1,100,1);
Pda=Param("Look back",13,1,50,1);
Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));

aa=Cross(C,LLV(Up,pda));
bb=Cross(HHV(Dn,pda),C);
Td[0]=1;
for(i=1;i<BarCount;i++ )
{
prev=Td[i-1];
if(aa)
{
Td=1;
}
else if(bb)
{
Td=-1;
}
else
{
Td=prev;
}
}
aa=Dn==HighestSince(Cross(Td,0),Dn);
Dnx=Dn[0];
for(i=1;i<BarCount;i++ )
{
prev=Dnx[i-1];
if(aa)
{
Dnx=Dn;
}
else
{
Dnx=prev;
}
}
aa=Up==LowestSince(Cross(0,Td),Up);
Upx=Up[0];
for(i=1;i<BarCount;i++ )
{
prev=Upx[i-1];
if(aa)
{
Upx=Up;
}
else
{
Upx=prev;
}
}
//ST:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
aa=Td==1;
bb=Td==-1;
ST[0]=1;
for(i=1;i<BarCount;i++ )
{
prev=ST[i-1];
if(aa)
{
ST=Dnx;
}
else if(bb)
{
ST=Upx;
}
else
{
ST=prev;
}
}
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(ST,"",colorTan,styleLine);
Plot(C,"",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0);

## Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

 Name: Phone: Email: City: State: Select StateAndaman and Nicobar IslandsAndhra PradeshArunachal PradeshAssamBiharChhattisgarhDadra and Nagar HaveliDaman and DiuDelhiGoaGujaratHaryanaHimachal PradeshJammu and KashmirJharkhandKarnatakaKeralaLakshadweepMadhya PradeshMaharashtraManipurMeghalayaMizoramNagalandOdishaPuducherryPunjabRajasthanSikkimTamil NaduTelanganaTripuraUttarakhandUttar PradeshWest Bengal Are you a day trader?