need AFL Code for Inserting (Manually) Daily, Weekl,Monthly Pivot/Supp/Res

#1
Dear Members,
Can anyone help me by coding my simple requirement of inserting the
following:
1)Pivot Point
2)3 Levels of Support and
3)3 Levels of Resistance
which I shall type in manually for the scrips that are present in
Amibroker.

Also, I would like to utilise the line COLOR alongwith the TYPE of
line to be drawn - Thick/Dotted/BOTH/NONE


as you already knows auto pivots does not work in our indian market because after adjustment the closing price change a lot (sometimes 10 points away from last traded price) which affect the calculation.
 

amar_gr

Active Member
#2
Hi Mukdu,

I have tried to code this as per your expectations, the only thing which is not as per your expectations is the line style combos.

Will try to figure that out and update. Hope this helps.

Cheers
Amar.
------

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", colorYellow , styleNoTitle, 1 );
// Plot( C, "Close", colorYellow , styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


P_col = ParamColor( "Pivot_Color", colorCycle );
P_LT = ParamStyle("Pivot_Line_Style" , Linestyle=styleDots);

R1 = Param("Res 01",3770);
R1_col = ParamColor( "R1_Color", colorCycle );
R1_LT = ParamStyle("R1_Line_Style" , Linestyle=styleDots) ;
R2 = Param("Res 02",3745);
R2_col = ParamColor( "R2_Color", colorCycle );
R2_LT = ParamStyle("R2_Line_Style" , Linestyle=styleDots) ;
R3 = Param("Res 03",3705);
R3_col = ParamColor( "R3_Color", colorCycle );
R3_LT = ParamStyle("R3_Line_Style" , Linestyle=styleDots);
S1 = Param("Sup 01",3595);
S1_col = ParamColor( "S1_Color", colorCycle );
S1_LT = ParamStyle("S1_Line_Style" , Linestyle=styleDots) ;
S2 = Param("Sup 02",3550);
S2_col = ParamColor( "S2_Color", colorCycle );
S2_LT = ParamStyle("S2_Line_Style" , Linestyle=styleDots) ;
S3 = Param("sup 03",3510);
S3_col = ParamColor( "Color", colorCycle );
S3_LT = ParamStyle("Line_Style" , Linestyle=styleDots) ;

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;

Plot (p,"Pivot",P_Col,P_LT);
Plot (r1,"R1",R1_Col,R1_LT);
Plot (r2,"R2",R2_Col,R2_LT);
Plot (r3,"R3",R3_Col,R3_LT);
Plot (s1,"S1",S1_Col,S1_LT);
Plot (s2,"S2",S2_Col,S2_LT);
Plot (s3,"S3",S3_Col,S3_LT);
 
#4
can you slightly modify it for me i want to make it semiautomatic
like when I apply it on any chart it will ask 4 parameters open high low close
and than automaticall calculate and apply pp res & support line

here is basic PP calculation
R4 = PP + RANGE*3
R3 = PP + RANGE*2
R2 = PP + RANGE
R1 = 2 * PP - L
PP = (H+L+C) / 3
S1 = 2 * PP - H
S2: PP - RANGE
S3: PP - RANGE*2
S4: PP - RANGE*3

thanks once again
 

amar_gr

Active Member
#5
Remove or mark all the lines of code R1 to R3, S1 - S3 with //

Ex. --> //R1 = Param("Res 01",3770);


Copy and paste the following lines of code in the next line below the Pivot point calculation line.


R1 = (2*p)-L1;
R2 = p + ((H1 - L1));
R3 = P + ((H1-L1)*2);
R4 = P + ((H1-L1)*3);

S1 = (2*p)-H1;
S2 = p - (H1 - L1);
S3 = P - ((H1-L1)*2);
S4 = P - ((H1-L1)*3);
 

Similar threads