Hi friends
Saw this metastock code
can somebody help me to get it as afl,please
purpose
I just like to see if ms code is any better than my existing stoploss code.
of course,I already have a stoploss code in the lines of jimberg.
see it at the end of this post
-------------------------------------------------
//mystoplosscode
SetChartBkColor(64);
BARCOLOR =IIf(C>O,colorGreen,colorRed);
Plot(C,"C",BARCOLOR,styleBar);
TrailStop25 = HHV( C - 2.5 * ATR(5), 15 );
STOPCOL= IIf(C>TrailStop25,colorBlue,colorCustom12);
Plot( TrailStop25, "Trailing stop2.5", STOPCOL, styleLine );
Plot(L,"LOW OF EACH BAR",colorViolet,styleDashed);
Plot(H,"HIGH OF EACH BAR",colorOrange,styleDashed);
//note for intraday trading use 1.5 factor in place of 2.5
//all the best
=================================
Saw this metastock code
can somebody help me to get it as afl,please
purpose
I just like to see if ms code is any better than my existing stoploss code.
of course,I already have a stoploss code in the lines of jimberg.
see it at the end of this post
HTML:
Can someone help me in converting the following Metastock code to
Amibroker AFL
A:=2.5*ATR(5) ; TL:=C-A; TS:=C+A;
ln:=if(C> =PREV,Max( TL,PREV), TL);
SH:=if(C< =PREV,Min( TS,PREV), TS);
U:=Cross(C,Ref( SH,-1));
D:=Cross(Ref( ln,-1),C) ;
I:=Cum(IsDefined( I+D))=1;
R:=BarsSince( I+U)<BarsSinc e(I+D);
if(R,ValueWhen( 1,1,ln),ValueWhen(1,1,SH) );
HTML:
//afl code is on these lines-incomplete
A=2.5*ATR(5);
TL =(C-A);
TS = (C+A);
PREV = GOD KNOWS!!!!!!!
ln = IIf(C> =PREV,Max( TL,PREV), TL);//LONG
SH = IIf(C< =PREV,Min( TS,PREV), TS);//SHORT
U = Cross(C,Ref( SH,-1));
D = Cross(Ref( ln,-1),C) ;
I=Cum(IsDefined( I+D))=1;
R=BarsSince( I+U)<BarsSinc e(I+D);
if(R,ValueWhen( 1,1,ln),ValueWhe n(1,1,SH) );
//ABOVE CODE INCOMPLETE-YET TO PREPARE- DONT TRY TO USE IT
//mystoplosscode
SetChartBkColor(64);
BARCOLOR =IIf(C>O,colorGreen,colorRed);
Plot(C,"C",BARCOLOR,styleBar);
TrailStop25 = HHV( C - 2.5 * ATR(5), 15 );
STOPCOL= IIf(C>TrailStop25,colorBlue,colorCustom12);
Plot( TrailStop25, "Trailing stop2.5", STOPCOL, styleLine );
Plot(L,"LOW OF EACH BAR",colorViolet,styleDashed);
Plot(H,"HIGH OF EACH BAR",colorOrange,styleDashed);
//note for intraday trading use 1.5 factor in place of 2.5
//all the best
=================================
Last edited: