Hi,
Some ideas applied to histogram MACD :
Best regards
// Macd Rising Falling Two Colors
// adapted by reinsley
// blank bars show no cross signal
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
mm = MACD(r1, r2);
ms = Signal(r1, r2, r3);
mh = mm-ms;
mcol= IIf(mh>Ref(mh,-1),IIf(mh > 0,27,27),IIf(mh >
0,32,32));// 27 43 11 32
Plot(mm,StrFormat(_SECTION_NAME()+"(%g,%g)", r1
,r2),29,4);
Plot(ms," Signal" + _PARAM_VALUES(),32);
Plot(mh,"MACDHistogram",mcol,6|styleNoTitle|4096);//32768|
Plot(mh,"MACDHistogram",mcol,5|styleNoTitle|4096);
//32768|
lastbar0 = Ref( mh, 0 ) > Ref( mh, - 1 )AND mh >= 0 ;
lastbar1 = Ref( mh, - 1 ) < Ref( mh, - 2 )AND mh >= 0 ;
lastbar2 = Ref( mh, - 2 ) < Ref( mh, - 3 )AND mh >= 0 ;
lastbar3 = Ref( mh, - 3 ) < Ref( mh, - 4 )AND mh >= 0 ;
signocrossup = IIf( lastbar0 AND lastbar1 AND lastbar2 AND lastbar3 ,
1, 0 );
barcolorup = IIf( signocrossup, 2, 1 );
lastbardn0 = Ref( mh, 0 ) < Ref( mh, - 1 )AND mh <= 0 ;
lastbardn1 = Ref( mh, - 1 ) > Ref( mh, - 2 )AND mh <= 0 ;
lastbardn2 = Ref( mh, - 2 ) > Ref( mh, - 3 )AND mh <= 0 ;
lastbardn3 = Ref( mh, - 3 ) > Ref( mh, - 4 )AND mh <= 0 ;
signocrossdown = IIf( lastbardn0 AND lastbardn1 AND lastbardn2 AND
lastbardn3 , 1, 0 );
barcolordn = IIf( signocrossdown, 2, 1 );
Graph2BarColor = IIf ( signocrossup, barcolorup, IIf( signocrossdown,
barcolordn, mcol ) );
//11 mauve //27 green //43 bright green //32 red
Le 23/12/2009 07:15, Deepak Patade a écrit :
>
> Can you helpme in this
> Plot the color of candle green if MACD is above signal line
> and
> Plot the candle red when signal line is above green line.
> Price
>
> ("Price");
>
> SetChartOptions(0,*chartShowArrows*|*chartShowDates*);
>
> _N(*Title* = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open
%g, Hi %g,
> Lo %g, Close %g (%.1f%%) Vol " +WriteVal( *V*, 1.0 ) +"
{{VALUES}}",
> *O*, *H*, *L*, *C*, SelectedValue( ROC( *C*, 1 )) ));
>
> Plot( *C*, "Close", ParamColor("Color", *colorBlack* ),
*styleNoTitle* |
> ParamStyle("Style") | GetPriceStyle() );
>
> * *
>
> *if*( ParamToggle("Tooltip shows", "All Values|Only Prices" )
)
>
> {
>
> *ToolTip*=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g
> (%.1f%%)\nVolume: "+NumToStr( *V*, 1 ), *O*, *H*, *L*, *C*,
> SelectedValue( ROC( *C*, 1 )));
>
> }
>
> macd
>
> r1 = Param( "Fast avg", 12, 2, 200, 1 );
>
> r2 = Param( "Slow avg", 26, 2, 200, 1 );
>
> r3 = Param( "Signal avg", 9, 2, 200, 1 );
>
> Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)",
r1, r2),
> ParamColor("MACD color", *colorBlue* ), ParamStyle("MACD
style") );
>
> Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
> ParamColor("Signal color", *colorRed* ), ParamStyle("Signal
style") );
>
> Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color",
> *colorBlack* ), *styleNoTitle* | ParamStyle("Histogram style",
> *styleHistogram* | *styleNoLabel*, *maskHistogram* ) );
>
>
> Deepak Patade,
> Nasik.
>
>
>
>
--
Best regards