Need Help in this Trend Color Code

aggy

Active Member
#1
HI all,

Dear Seniors fellow members i need help in the code which i downloaded from the internet.

This is the code in which i made some modifications ...


_SECTION_BEGIN("Trend Check");

p= Param("shortperiods",15,2,300,1);

e1= EMA(C,p);

p2= Param("medperiods",25,2,300,1);

e2= EMA(C,p2);

p3= Param("longperiods",35,2,300,1);

e3= EMA(C,p3);

d1= e1-e2;

d2= e2-e3;

df= d1-d2;

/*
//ORIGINAL
Plot(d1,"aggy",IIf(d1>Ref(d1,-1) AND d1>d2,colorGreen,IIf(d1>Ref(d1,-1) AND d1<d2,colorYellow,IIf(d1<Ref(d1,-1) AND d1<d2,colorRed,IIf(d1<Ref(d1,-1) AND d1>d2,colorYellow,colorBlue)))),styleLine);
Plot(d2,"advika",IIf(d2>Ref(d2,-1) AND d1>d2,colorGreen,IIf(d2>Ref(d2,-1) AND d1<d2,colorYellow,IIf(d2<Ref(d2,-1) AND d1<d2,colorRed,IIf(d2<Ref(d2,-1) AND d1>d2,colorYellow,colorBlue)))),styleLine);

//MODIFIED BY ME
Plot(d1,"aggy",IIf(d1>Ref(d1,2) AND d1>d2,colorYellow,IIf(d1>Ref(d1,2) AND d1<d2,colorRed,IIf(d1<Ref(d1,2) AND d1<d2,colorYellow,IIf(d1<Ref(d1,2) AND d1>d2,colorGreen,colorBlue)))),styleLine);
Plot(d2,"advika",IIf(d2>Ref(d2,2) AND d1>d2,colorYellow,IIf(d2>Ref(d2,2) AND d1<d2,colorRed,IIf(d2<Ref(d2,2) AND d1<d2,colorYellow,IIf(d2<Ref(d2,2) AND d1>d2,colorGreen,colorBlue)))),styleLine);


My problem is in my code the line color change to BLUE instead of GREEN kindly help me out.
Same with if trend change RED it shows BLUE
KIndly help me out thanks in advance
 

Attachments

Similar threads