one line added.
( dynacolor=IIf(trendup,colorGreen,colorRed);
SetBarFillColor(dynacolor);)
Code:
n= Param("No. of Bars",4,2,8,1);
TrendUp = C > Ref(HHV(H,n),-1);
TrendDn = C < Ref(LLV(L,n),-1);
TrendUp = ExRem(TrendUp,TrendDn);
TrendDn = ExRem(TrendDn,TrendUp);
Buy= TrendUp;
Sell = TrendDn;
Short=TrendDn;
Cover= TrendUp;
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorGreen, layer = 0,yposition = Low, offset = -20);
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorRed, layer = 0, yposition = High, offset = -20);
TrendUp = Flip(TrendUp,TrendDn);
TrendDn = Flip(TrendDn,TrendUp);
dynacolor=IIf(trendup,colorGreen,colorRed);
[B] SetBarFillColor(dynacolor);[/B]
Plot(C,"CLose",IIf(trendup,colorGreen,colorRed),64);
Further to the above, I am trying to combine additional indicators to generate the signal. I am trying to mix TRIX and WMA for generating signals.
_SECTION_BEGIN("TEMA");
B=C>WMA(H,7);
S=C<WMA(L,7);
B=ExRem(B,S);
S=ExRem(S,B);
shape = B * shapeUpArrow + S * shapeDownArrow;
PlotShapes( shape, IIf( B, colorBlue, colorRed ),0, IIf( B, Low, High ),-20 );
b1=Bull_Trend=Trix(12) > EMA(Trix(12),3);
s1=Bear_Trend=Trix(12)<EMA(Trix(12),3);
Bull_trend= Flip(Bull_trend,Bear_Trend);
Bear_Trend= Flip(Bear_trend,Bull_Trend);
Ribbon_kol=IIf(Bull_Trend,colorGreen, IIf(Bear_Trend,colorRed, colorBlack));
Plot(4, "ribbon", Ribbon_kol, styleOwnScale|styleArea|styleNoLabel, -0.5,100);
n= Param("No. of Bars",4,2,8,1);
Impulse_UP = C > Ref(HHV(H,4),-1);
Impulse_Down = C < Ref(LLV(L,4),-1);
Impulse_UP = ExRem(Impulse_UP,Impulse_Down);
Impulse_Down = ExRem(Impulse_Down,Impulse_UP);
Impulse_Up = Flip(Impulse_Up,Impulse_down);
Impulse_down = Flip(Impulse_down,Impulse_up);
bar_kol=IIf(Impulse_UP,colorGreen,colorRed);
SetBarFillColor(bar_kol);
Plot(C,"CLose",IIf(Bar_kol,colorGreen,colorRed),64);
Buy= (B AND Bull_Trend) OR (B AND bar_kol==colorGreen) OR (B AND Bull_Trend AND bar_kol==colorGreen);
Sell=(S AND Bear_Trend) OR (S AND bar_kol==colorRed) OR ( S AND Bear_Trend AND bar_kol==colorRed) ;
Short= (S AND Bear_Trend) OR (S AND bar_kol==colorRed) OR ( S AND Bear_Trend AND bar_kol==colorRed) ;
Cover= (B AND Bull_Trend) OR (B AND bar_kol==colorGreen) OR (B AND Bull_Trend AND bar_kol==colorGreen);
Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
_SECTION_END();
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
_SECTION_END();
This is my attempt at CUT and PASTE of codes as my ami programming skills are negligible.
I am attempting to do this
1. Buy / sell arrows based on close crossing WMA 7
2. Bar volour based on the 4 day high /low as per the code modified by Veera/Sr114.
3. Ribbon colour based on TRIX 12.
All individually seems to work. My requirement is
1. BUY when any two conditions are met. My problem is when a buy arrow is printed and it has red bar and red ribbon, no BUY. But in next bar,if the bar or Ribbon turns green , a buy needs to be shown( not arrow- a dot should do. )
2. reverse for Sell/short.
CAn somebody help me in this . Sorry for troubling .
Thanks in advance.