Please convert the following metastock formula in amibroker afl .

#1
HELLO I AM APPENDING METASTOCK FORMULAS PLEASE CONVERT THEM IN AMI AFL


FORMULA 1 ---- DESCENDING TRIADS -----


m1:=h>Ref(h,-1) and l>ref(l,-1);
m2:=h>ref(h,-2) and l>ref(l,-2)and
h>ref(h,-1) and l<ref(l-1);
m3:=h>ref(h,-3)and l<ref(l,-3)and
h>ref(h,-2)and l<ref(l,-2)and
h>ref(h,-1)and l<ref(l,-1);
mark:=m1 or m2 or m3;
set:=lvaluewhen(1,mark,l)and h<valuewhen(1,mark,h)and
highestsince(1,ref(mark,-1),h)<valuewhen(1,mark,h);
sig:if (mark,1, if (set,0,prev);
cross(sig = 0 ,0.5);



after this i will post the formula for ascending triad


thanks
 

extremist

Well-Known Member
#2
HELLO I AM APPENDING METASTOCK FORMULAS PLEASE CONVERT THEM IN AMI AFL


FORMULA 1 ---- DESCENDING TRIADS -----


m1:=h>Ref(h,-1) and l>ref(l,-1);
m2:=h>ref(h,-2) and l>ref(l,-2)and
h>ref(h,-1) and l<ref(l-1);
m3:=h>ref(h,-3)and l<ref(l,-3)and
h>ref(h,-2)and l<ref(l,-2)and
h>ref(h,-1)and l<ref(l,-1);
mark:=m1 or m2 or m3;
set:=lvaluewhen(1,mark,l)and h<valuewhen(1,mark,h)and
highestsince(1,ref(mark,-1),h)<valuewhen(1,mark,h);
sig:if (mark,1, if (set,0,prev);
cross(sig = 0 ,0.5);



after this i will post the formula for ascending triad


thanks
i converted the code
plz try and tell me......

Code:
m1 = H<Ref(H,-1) AND L<Ref(L,-1);
m2 = H<Ref(H,-2) AND L<Ref(L,-2) AND H>Ref(H,-1)AND L<Ref(L,-1);
m3 =H<Ref(H,-3) AND L<Ref(L,-3) AND H>Ref(H,-2) AND L<Ref(L,-2) AND H>Ref(H,-1) AND L<Ref(L,-1);
mark = m1 OR m2 OR m3;
mark2 = m1 and m2 and m3;
set = L >ValueWhen(mark,L) AND H>ValueWhen(mark,H) AND LowestSince(Ref(mark,-1),L) > ValueWhen(mark,L);

sig=0;
sig = Iif(mark,1, Iif(set,0,Ref(sig,-1)));

plot(sig,"",colorblack);
PlotShapes(mark*shapesmallcircle,colorbrightgreen, 0,0.5,0);

m1 = H>Ref(H,-1) AND L>Ref(L,-1);
m2 = H>Ref(H,-2) AND L>Ref(L,-2) AND H>Ref(H,-1) AND L<Ref(L,-1);
m3 = H>Ref(H,-3) AND L>Ref(L,-3) AND H>Ref(H,-2) AND L<Ref(L,-2) AND H>Ref(H,-1) AND L<Ref(L,-1);
mark = m1 OR m2 OR m3;
set =L<ValueWhen(mark,L) AND H<ValueWhen(mark,H) AND HighestSince(Ref(mark,-1) , H) < ValueWhen(mark,H);
sig=0;
sig = Iif(mark,1, Iif(set, 0, Ref(sig,-1)));
plot(sig,"",colorwhite);

PlotShapes(mark*shapesmallcircle,colorred, 0,0.45,0);
First u will see this code.....
then u will upload remaining part of code for conversion.....
so i reduced ur hard work.
I converted both DESCENDING TRIADS and ascending TRIADS .

Enjoy........
 
Last edited:

cloudTrader

Well-Known Member
#6
i converted the code
plz try and tell me......

Code:
m1 = H<Ref(H,-1) AND L<Ref(L,-1);
m2 = H<Ref(H,-2) AND L<Ref(L,-2) AND H>Ref(H,-1)AND L<Ref(L,-1);
m3 =H<Ref(H,-3) AND L<Ref(L,-3) AND H>Ref(H,-2) AND L<Ref(L,-2) AND H>Ref(H,-1) AND L<Ref(L,-1);
mark = m1 OR m2 OR m3;
mark2 = m1 and m2 and m3;
set = L >ValueWhen(mark,L) AND H>ValueWhen(mark,H) AND LowestSince(Ref(mark,-1),L) > ValueWhen(mark,L);

sig=0;
sig = Iif(mark,1, Iif(set,0,Ref(sig,-1)));

plot(sig,"",colorblack);
PlotShapes(mark*shapesmallcircle,colorbrightgreen, 0,0.5,0);

m1 = H>Ref(H,-1) AND L>Ref(L,-1);
m2 = H>Ref(H,-2) AND L>Ref(L,-2) AND H>Ref(H,-1) AND L<Ref(L,-1);
m3 = H>Ref(H,-3) AND L>Ref(L,-3) AND H>Ref(H,-2) AND L<Ref(L,-2) AND H>Ref(H,-1) AND L<Ref(L,-1);
mark = m1 OR m2 OR m3;
set =L<ValueWhen(mark,L) AND H<ValueWhen(mark,H) AND HighestSince(Ref(mark,-1) , H) < ValueWhen(mark,H);
sig=0;
sig = Iif(mark,1, Iif(set, 0, Ref(sig,-1)));
plot(sig,"",colorwhite);

PlotShapes(mark*shapesmallcircle,colorred, 0,0.45,0);
First u will see this code.....
then u will upload remaining part of code for conversion.....
so i reduced ur hard work.
I converted both DESCENDING TRIADS and ascending TRIADS .

Enjoy........
@ Extremist Bro,

Sumit has pointed out that he posted the wrong code for descending triads in his first post. He has given the image of the correct code in another post.

Have a look at the image and kindly make the changes in the afl code.

Thanks.
 

casoni

Well-Known Member
#7
Hello
check this formula ....
coded by Tomasz Janeczko

//Exploration for Triangles


Equal = (C>O AND H<Ref(H,-2) AND Ref(H,-2)<Ref(H,-4) AND Ref(L,-1)>Ref(L,-3)) OR
(C<O AND L>Ref(L,-2) AND Ref(L,-2)>Ref(L,-4) AND Ref(H,-1)<Ref(H,-3));

Ascend = (C>O AND ( (H<Ref(H,-2) AND Ref(H,-2)==Ref(H,-4)) OR H==Ref(H,-2) ) AND
Ref(L,-1)>Ref(L,-3)) OR (C<O AND ( (Ref(H,-1)<Ref(H,-3) AND
Ref(H,-3)==Ref(H,-5)) OR Ref(H,-1)==Ref(H,-3) ) AND L>Ref(L,-2) AND
Ref(L,-2)>Ref(L,-4));

Descend = (C>O AND ( (Ref(L,-1)>Ref(L,-3) AND Ref(L,-3)==Ref(L,-5)) OR
Ref(L,-1)==Ref(L,-3) ) AND H<Ref(H,-2) AND Ref(H,-2)<Ref(H,-4)) OR (C<O AND (
(L>Ref(L,-2) AND Ref(L,-2)==Ref(L,-4)) OR L==Ref(L,-2) ) AND
Ref(H,-1)<Ref(H,-3));


Plot(C,"",3,132);
Plot(Ascend,"Asc",4, styleHistogram | styleOwnScale, 0, 1 );
Plot(Descend ,"Dec",6, styleHistogram | styleOwnScale, 0, 1 );
Plot(Equal ,"Eq",31, styleHistogram | styleOwnScale, 0, 1 );
 

extremist

Well-Known Member
#8
@ Extremist Bro,

Sumit has pointed out that he posted the wrong code for descending triads in his first post. He has given the image of the correct code in another post.

Have a look at the image and kindly make the changes in the afl code.

Thanks.
Bro though he has posted the wrong code i searched the code on net my self and coded the correct formula.
you plz chk and let me know.
 
#9
@ Extremist Bro,

Sumit has pointed out that he posted the wrong code for descending triads in his first post. He has given the image of the correct code in another post.

Have a look at the image and kindly make the changes in the afl code.

Thanks.
Yhe code posted by Extremist is as per the image code.... Guess he knew the formula before itself...
 

extremist

Well-Known Member
#10
Hello
check this formula ....
coded by Tomasz Janeczko

//Exploration for Triangles


Equal = (C>O AND H<Ref(H,-2) AND Ref(H,-2)<Ref(H,-4) AND Ref(L,-1)>Ref(L,-3)) OR
(C<O AND L>Ref(L,-2) AND Ref(L,-2)>Ref(L,-4) AND Ref(H,-1)<Ref(H,-3));

Ascend = (C>O AND ( (H<Ref(H,-2) AND Ref(H,-2)==Ref(H,-4)) OR H==Ref(H,-2) ) AND
Ref(L,-1)>Ref(L,-3)) OR (C<O AND ( (Ref(H,-1)<Ref(H,-3) AND
Ref(H,-3)==Ref(H,-5)) OR Ref(H,-1)==Ref(H,-3) ) AND L>Ref(L,-2) AND
Ref(L,-2)>Ref(L,-4));

Descend = (C>O AND ( (Ref(L,-1)>Ref(L,-3) AND Ref(L,-3)==Ref(L,-5)) OR
Ref(L,-1)==Ref(L,-3) ) AND H<Ref(H,-2) AND Ref(H,-2)<Ref(H,-4)) OR (C<O AND (
(L>Ref(L,-2) AND Ref(L,-2)==Ref(L,-4)) OR L==Ref(L,-2) ) AND
Ref(H,-1)<Ref(H,-3));


Plot(C,"",3,132);
Plot(Ascend,"Asc",4, styleHistogram | styleOwnScale, 0, 1 );
Plot(Descend ,"Dec",6, styleHistogram | styleOwnScale, 0, 1 );
Plot(Equal ,"Eq",31, styleHistogram | styleOwnScale, 0, 1 );
Bro Triangles r different Than the tirades he mentioned here.
Even the logic of the code is different than that of triangles
 

Similar threads