Pivot Support Resistance with MA



Pivot Support Resistance with MA
Pivot Support Resistance with MA


//www.aflcode.com

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() );
H1=SelectedValue( TimeFrameGetPrice( "H", inDaily, -1 ));
L1=SelectedValue(TimeFrameGetPrice( "L", inDaily, -1 ));
C1=SelectedValue(TimeFrameGetPrice( "C", inDaily, -1 ));
/*PIVOT Calculation*/
p = ( H1+ L1 + C1 )/3;
s1 = (2*p)-H1;
r1 = (2*p)-L1;
s2 = p -(H1 - L1);
s3 = S1 - (H1-L1);
r2 = p +(H1 - L1);
r3 = R1 +(H1-L1);

Plot (p,"Pivot",25,styleDots);
Plot (r1,"R1",12,1);
Plot (r2,"R2",12,1);
Plot (r3,"R3",12,1);
Plot (s1,"S1",3,1);
Plot (s2,"S2",3,1);
Plot (s3,"S3",3,1);
X=Cross(C,p);
Z=Cross(p,C);
PlotShapes(IIf(X,shapeUpTriangle,shapeNone),colorAqua,0,Low,Offset=-20);
PlotShapes(IIf(Z,shapeDownTriangle,shapeNone),colorPink,0,High,Offset=-20);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

_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") ); 
_SECTION_END();

_SECTION_BEGIN("MA1");
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();

Previous
Next Post »