Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Super Trend (convert from metastock) for Amibroker (AFL)
Link: http://www.inditraders.com/amibroker/5324-supertrend-oliver-seban.html
Code meta:
Factor:=Input(“Factor”,1.00,10.00,3.00);
Pd:=Input(“ATR Periods”,1,100,10);
Up:=MP);
Dn:=MP);
Td:=If(Cross(C,LLV),1,If(Cross(HHV,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
I converted and uploaded to inditraders too.
Similar Indicators / Formulas
Indicator / Formula
Factor=Param("Factor",3,1,10,1); Pd=Param("ATR Periods",10,1,100,1); Up=(H+L+C)/3+(Factor*ATR(Pd)); Dn=(H+L+C)/3-(Factor*ATR(Pd)); PREV1=1; PREV1=Ref(IIf(Cross(C,LLV(Up,13)),1,IIf(Cross(HHV(Dn,13),C ),-1,PREV1)),-1); Td=IIf(Cross(C,LLV(Up,13)),1,IIf(Cross(HHV(Dn,13),C ),-1,PREV1)); PREV2=Dn; PREV2=Ref(IIf(Dn==HighestSince(Cross(Td,0),Dn,1),Dn,PREV2),-1); Dnx=IIf(Dn==HighestSince(Cross(Td,0),Dn,1),Dn,PREV2) ; PREV3=Up; PREV3=Ref(IIf(Up==LowestSince(Cross(0,Td),Up,1),Up,PREV3),-1); Upx=IIf(Up==LowestSince(Cross(0,Td),Up,1),Up,PREV3); PREV4=Dnx; PREV4=IIf(Td==1,Dnx,IIf(Td==-1,Upx,PREV4)); ST=IIf(Td==1,Dnx,IIf(Td==-1,Upx,PREV4)); Plot(ST,"SuperStrength",colorRed,styleLine);
10 comments
Leave Comment
Please login here to leave a comment.
Back
The Metastock code above is not correct. Here is the IndiTrader code:
If this code is plotted in Metastock it is different than that obtained in AmiBroker. So the AFL conversion is not correct. I’d post the charts but can’t figure out how.
Thank you very much.
How do you understand the PREV in metastock code?
Could you convert the following code too?
AMA Binary Wave
the supertrend code is translated as:
the other code is translated as:
Metastock code:
empottasch’s Metastock PREV conversion to AFL provides the correct result. For those who want to convert PREV in the future you might find the messages posted on the AmiBroker Yahoo forum through the years about doing the conversion with both arrays and loops useful.
I added a little extra code to the supertrend to give the trend a color:
Thank for your great help.
Thanks empottasch very much. You learned me a lot. ^^~
but error in code not work !!!! in ami5.20
DearSir,
I have One Metastock Formula, I want to Use this formula into Amibroker
Will U Please Help me Anyone for COnvert METASTOCK FORMULA into Amibroker
buy
period:=(10);
atrfact:=(6);
HiLo:=If(H-L<1.5*Mov(H-L,period,S),H-L, 1.5*Mov(H-L,period,S));
Href:=If(L<=Ref(H,-1),H-Ref(C,-1),(H-Ref(C,-1))-(L-Ref(H,-1))/2);
Lref:=If(H>=Ref(L,-1),Ref(C,-1)-L,(Ref(C,-1)-L)-(Ref(L,-1)-H)/2);
diff1:=Max(HiLo,Href);
diff2:=Max(diff1,Lref);
atrmod:=Wilders(diff2,period);
loss:=atrfact*atrmod;
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail;
C>Trail
sell
period:=(10);
atrfact:=(6);
HiLo:=If(H-L<1.5*Mov(H-L,period,S),H-L, 1.5*Mov(H-L,period,S));
Href:=If(L<=Ref(H,-1),H-Ref(C,-1),(H-Ref(C,-1))-(L-Ref(H,-1))/2);
Lref:=If(H>=Ref(L,-1),Ref(C,-1)-L,(Ref(C,-1)-L)-(Ref(L,-1)-H)/2);
diff1:=Max(HiLo,Href);
diff2:=Max(diff1,Lref);
atrmod:=Wilders(diff2,period);
loss:=atrfact*atrmod;
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail;
C<Trail