A little help in this indicator code......

#1
Please have a look at this indicator........I was trying to modify it the way I want so that it makes my work a bit easy........I've plotted the trend ribbon for this indicator at the bottom........it does change into green when the indicator changes to green and also changes to red when the indicator changes to red............but the problem is that it does not change when the indicator color is BLUE...........I've tried many times modifying the code but I was not sucessful............


Can someone please modify the code in the trend ribbon section so that the trend ribbon also turns into blue when the indicator changes to blue.








_SECTION_BEGIN("Unnamed 3");
Plot(100,"",colorBlack,styleDashed);
Plot(-100,"",colorBlack,styleDashed);
n= Param ( "Periods", 9, 1, 200, 1 );
ys1=(High+Low+Close*2)/4;
rk3=EMA(ys1,n);
rk4=StDev(ys1,n);
rk5=(ys1-rk3)*100/rk4;
rk6=EMA(rk5,n);
UP=EMA(rk6,n);
DOWN=EMA(up,n);
Oo=IIf(up<down,up,down);
Hh=Oo;
Ll=IIf(up<down,down,up);
Cc=Ll;
barcolor2=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),colorBlue,IIf(up>down,colorGreen,colorRed));
PlotOHLC( Oo,hh,ll,Cc, "Potential " + Name(), barcolor2, ParamStyle ("Style") );
Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", IIf( up>down, colorLime, IIf( down>up, colorRed, IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, colorBlue ))), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );

_SECTION_END();
 
#2
Code:
Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", 

1.  IIf( up>down, colorLime,   

2.  IIf( down>up, colorRed, 

3.  IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, colorBlue ))), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );
In the above If 1 is false then 2 is true and when 2 is false 1 is true so condition 3 is never checked for true/false, (will happen only when down==up)

change the sequence to force check for condition 3 first then use 1,2

Code:
Plot(1,"ribbon",IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, IIf( up>down, colorLime,  IIf( down>up, colorRed, colorBlue ))),styleOwnScale|styleArea|styleNoLabel, -01, 50 );

Cheers
::thumb::
 
#4
Thanks for the help..........



Code:
Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", 

1.  IIf( up>down, colorLime,   

2.  IIf( down>up, colorRed, 

3.  IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, colorBlue ))), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );
In the above If 1 is false then 2 is true and when 2 is false 1 is true so condition 3 is never checked for true/false, (will happen only when down==up)

change the sequence to force check for condition 3 first then use 1,2

Code:
Plot(1,"ribbon",IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, IIf( up>down, colorLime,  IIf( down>up, colorRed, colorBlue ))),styleOwnScale|styleArea|styleNoLabel, -01, 50 );

Cheers
::thumb::
 

johnnypareek

Well-Known Member
#5
HTML:
Please have a look at this indicator........I was trying to modify it the way I want so that it makes my work a bit easy........I've plotted the trend ribbon for this indicator at the bottom........it does change into green when the indicator changes to green and also changes to red when the indicator changes to red............but the problem is that it does not change when the indicator color is BLUE...........I've tried many times modifying the code but I was not sucessful............


Can someone please modify the code in the trend ribbon section so that the trend ribbon also turns into blue when the indicator changes to blue.



Hi,

hope this is what u wanted. :)
enjoy
johnny

HTML:
_SECTION_BEGIN("Unnamed 3");
Plot(100,"",colorBlack,styleDashed);
Plot(-100,"",colorBlack,styleDashed);
n= Param ( "Periods", 9, 1, 200, 1 );
ys1=(High+Low+Close*2)/4;
rk3=EMA(ys1,n);
rk4=StDev(ys1,n);
rk5=(ys1-rk3)*100/rk4;
rk6=EMA(rk5,n);
UP=EMA(rk6,n);
DOWN=EMA(up,n);
Oo=IIf(up<down,up,down);
Hh=Oo;
Ll=IIf(up<down,down,up);
Cc=Ll;
barcolor2=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),colorBlue,IIf(up>down,colorGreen,colorRed));
PlotOHLC( Oo,hh,ll,Cc, "Potential " + Name(), barcolor2, ParamStyle ("Style") );
//Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", IIf( up>down, colorLime, IIf( down>up, colorRed, IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, colorBlue ))), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );
Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", barcolor2,/* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );
_SECTION_END();
 
#6
I already got help from the other member that I wanted......anyway thanks for the reply...............btw has anyone got the livesignal.in afl............just wanted the trend finding feature ( trend shown in RED,BLUE and GREEN ), dont need their complete system.













HTML:
Please have a look at this indicator........I was trying to modify it the way I want so that it makes my work a bit easy........I've plotted the trend ribbon for this indicator at the bottom........it does change into green when the indicator changes to green and also changes to red when the indicator changes to red............but the problem is that it does not change when the indicator color is BLUE...........I've tried many times modifying the code but I was not sucessful............


Can someone please modify the code in the trend ribbon section so that the trend ribbon also turns into blue when the indicator changes to blue.



Hi,

hope this is what u wanted. :)
enjoy
johnny

HTML:
_SECTION_BEGIN("Unnamed 3");
Plot(100,"",colorBlack,styleDashed);
Plot(-100,"",colorBlack,styleDashed);
n= Param ( "Periods", 9, 1, 200, 1 );
ys1=(High+Low+Close*2)/4;
rk3=EMA(ys1,n);
rk4=StDev(ys1,n);
rk5=(ys1-rk3)*100/rk4;
rk6=EMA(rk5,n);
UP=EMA(rk6,n);
DOWN=EMA(up,n);
Oo=IIf(up<down,up,down);
Hh=Oo;
Ll=IIf(up<down,down,up);
Cc=Ll;
barcolor2=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),colorBlue,IIf(up>down,colorGreen,colorRed));
PlotOHLC( Oo,hh,ll,Cc, "Potential " + Name(), barcolor2, ParamStyle ("Style") );
//Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", IIf( up>down, colorLime, IIf( down>up, colorRed, IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1), colorBlue, colorBlue ))), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );
Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon", barcolor2,/* choose color */ styleOwnScale|styleArea|styleNoLabel, -01, 50 );
_SECTION_END();
 

Similar threads