Sunday, 14 September 2014

SWING MULTIPLE MOVING AVERAGES WITH ZIGZAG

SWING  MULTIPLE MOVING AVERAGES WITH ZIGZAG




_SECTION_BEGIN("Set Chart");
SetChartBkGradientFill(ParamColor("Inner panel upper", colorBlack), ParamColor("Inner panel lower", colorBlack));
Title =EncodeColor(colorYellow)+ "SWING"+ "-- " + EncodeColor(colorRed)+ "MULTIPLE"+ " "+ EncodeColor(colorBrightGreen)+"MOVING AVERAGES WITH ZIGZAG" +"\n" + EncodeColor(colorWhite)+ "CNBONDRE"+ " - " + FullName() + " - " + EncodeColor(colorYellow)+ Interval(2) + EncodeColor(colorYellow) +
" - " +EncodeColor(colorCustom11)+ Date() +" - "+"-" +EncodeColor(colorAqua) +"  Op="+O+" "+"  Hi="+H+" "+"  Lo="+L+" "+"  Cl="+C+" "+  "  Ch= "+ WriteVal( ROC( C, 1 ),1.2)+"%" + "   Vol="+ WriteVal(V)+"\n";


StyleList= ParamList("Chart Style", "Candle,Bar");
style =IIf(StyleList== "Candle",styleCandle, styleBar=128);
GreenBar = IIf(C > O, True, False);
RedBar = IIf(C < O, True, False);
BarColor = IIf(GreenBar, colorWhite, IIf(RedBar, colorWhite, colorWhite));
PlotOHLC(O, H, L, C, "", BarColor, style );
_SECTION_END();

_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
m=MA( P, Periods );
_SECTION_END();

_SECTION_BEGIN("MA2");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
s= EMA( P, Periods );
_SECTION_END();



PlotText(" Ch= "+WriteVal(ROC(C,1),1.2)+"%",BarCount,LastValue(C),42);
numBars = BarsSince(DateNum()!=Ref(DateNum(),-1))+1;
PlotText(" \n dm = "+WriteVal    ((m-s)/Ref((m-s),-1))      ,BarCount,LastValue(C),42);

_SECTION_BEGIN("Fill Color");
Cloudswitch = ParamToggle("Fill Color","On,Off");
dynamic_color = IIf( m > s, ParamColor("Down Color", colorSeaGreen ), ParamColor("Up Color", colorOrange ));
PlotOHLC( IIf(Cloudswitch,-1e10,m),IIf(Cloudswitch,-1e10,m),IIf(Cloudswitch,-1e10,s),IIf(Cloudswitch,-1e10,m), "", dynamic_color, styleNoLabel | styleCloud );
_SECTION_END();

No comments:

Post a Comment

Thanks