Afl for following condition

XRAY27

Well-Known Member
#1
Dear members
Please post afl for following condition
if a bar is above EMA 5 and EMA 12 green and below EMA5 and EMA 12 red
 

sr114

Well-Known Member
#2
Dear members
Please post afl for following condition
if a bar is above EMA 5 and EMA 12 green and below EMA5 and EMA 12 red
_SECTION_BEGIN("BAR COLOR");
a=ema(C,5);
b=ema(C,12);

cond1= C>a AND C>b;
cond2= C<a AND C<b;

colorbar=IIF(cond1,colorgreen,colorred);

plot(C,"",colorbar,stylebar);

_SECTION_END();
rgds
subroto
 

XRAY27

Well-Known Member
#3
Dear subroto sir,
Thank you very much for the afl for cross over of Ema5 and Ema12 bar colour blue please give this also
 

sr114

Well-Known Member
#4
Dear subroto sir,
Thank you very much for the afl for cross over of Ema5 and Ema12 bar colour blue please give this also
here it is
_SECTION_BEGIN("BAR COLOR");
a=EMA(C,5);
b=EMA(C,12);

cond1= C>a AND C>b;
cond2= C<a AND C<b;
Cond3=Cross(a,b);

colorbar=IIf(cond3,colorBlue,IIf(cond1,colorGreen,colorRed));

Plot(C,"Close",colorbar,styleBar);
_SECTION_END();
rgds
subroto
 
#5
Hi friends

Let me add this twist.
say- a trend begins when ema5 cross above ema12,start marked by bluebar,end marked by yellow bar.
say a downtrend begins with ema5 cross below ema12 and ends when ema5 cross above ema12-say yellow bar to Bluebar.
CHECK IT UP
 

Similar threads