Simple Coding Help - No Promise.

i tried to use above afl for 10 min time frame by changing following lines
tf=10;
tfrm=in1minute*tf;

timeframerestore();

m10=timeframeexpand(mm,in10minute,expandfirst);
s10=timeframeexpand(ss,in10minute,expandfirst);
a1=timeframeexpand(a1,in10minute,expandfirst);
b1=timeframeexpand(b1,in10minute,expandfirst);
d1=timeframeexpand(d1,in10minute,expandfirst);
e1=timeframeexpand(e1,in10minute,expandfirst);

as amibroker dont allow 10min time frame what should be used in below line

a1=timeframeexpand(a1,in10minute,expandfirst);

as per my knowledge u can use below line

timeframeset(in5minute*2);
 
Dear Sir,

I want the AFL Formula for following condition to plot the line on Chart,

if (Todays High)< (Yesterdays High) then Yesterdays Low (-)(Yesterdays High (-) Todays High) other wise Nil.
if above condition fulfill then only line should be ploted on chart otherwise no line.

if (Todays Low) > (Yesterdays Low) then Yesterdays High (+)(Todays Low -Yesterdays Low) other wise nil.

If above condition fulfill then only line should be ploted on chart otherwise no line.

I shall be thankful if anybody help for the same.

Thanks in adavance,

Maruti Mane
 

Nehal_s143

Well-Known Member
Hi

below afl plot level only for current period, i want to plot level for old period too as shown in snap shot, please help me to plot level on complete data





Code:
_SECTION_BEGIN("Trading");

pShowtradeLines = ParamToggle("Show Trade Lines", "No|Yes", 1);
PerctakeProfit=Param("Take Profit Percent Set",0.6,0.3,30,0.1);
PercStoploss=Param("StopLoss Percent Set",0.25,0.2,5,0.1);

PlotOHLC(Open,High,Low,Close,"",colorWhite,styleCandle);
Bars = 0;
xpdh = 90;

Plot_Range = DayOfWeek() > 0;
FH_Range = DayOfWeek() > 1;

FH_Prices = High * FH_Range;
FH_Marker = BarsSince(FH_Range>0);

Num_Bars = 5;

TimeFrameSet(inWeekly);
TOP_ = Open;
PDH_ = Ref(High,-1);
PDL_ = Ref(Low,-1);
PDO_ = Ref(Open,-1);
PDC_ = Ref(Close,-1);
PDM_ = (PDH_+PDL_)/2;
TimeFrameRestore();

isAll = True;
isRth = DayOfWeek() <= 1;  // monday
isdRth = DayOfWeek() > 1; // Tuesday to saturday

aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);

TOP = TimeFrameExpand(TOP_,inWeekly,expandFirst);
PDH = TimeFrameExpand(PDH_,inWeekly,expandFirst);
PDL = TimeFrameExpand(PDL_,inWeekly,expandFirst);
PDO = TimeFrameExpand(PDO_,inWeekly,expandFirst);
PDC = TimeFrameExpand(PDC_,inWeekly,expandFirst);
PDM = TimeFrameExpand(PDM_,inWeekly,expandFirst);
FHH = Ref(HHV(High*FH_Range,Num_Bars),-FH_Marker);
FHL = TimeFrameCompress( aRthL, inWeekly, compressLow );
FHL = TimeFrameExpand( FHL, inWeekly, expandFirst );
DayH = TimeFrameCompress( aRthH, inWeekly, compressHigh );
DayH = TimeFrameExpand( DayH, inWeekly, expandFirst );
DayL = TimeFrameCompress( aRthLd, inWeekly, compressLow );
DayL = TimeFrameExpand( DayL, inWeekly, expandFirst );



FC1=((PDH-PDL)*0.433);
FC2=((PDH-PDL)*0.7666);
FC3=((PDH-PDL)*1.355);
FC4=(FHH-FHL);

A=IIf((FC4<=FC1+PDH*0.005),FC1,0);
B=IIf((FC4<=FC2+PDH*0.005 AND FC4>FC1+PDH*0.005),FC2,0);
Cl=IIf((FC4<=FC3 AND FC4>FC2+PDH*0.005),FC3,0);
AF=(A+B+Cl);

BuyPrice=(DayL+AF);
BuyTP1=(BuyPrice+(BuyPrice*(PerctakeProfit/100)));
BuyTP2=(C>=BuyTP1);
SellPrice=(DayH-AF);
SellTP1=(SellPrice-(SellPrice*(PerctakeProfit/100)));
SellTP2=(C<=SellTP1);
percchange=(((C-TOP)/TOP)*100);
BuyStop1=(BuyPrice-(BuyPrice*(PercStoploss/100)));
BuyStop2=IIf((BuyStop1<=SellPrice) AND SellPrice<=BuyPrice,SellPrice,BuyStop1);
SellStop1=(SellPrice+(SellPrice*(PercStoploss/100)));
SellStop2=IIf((SellStop1>=BuyPrice) AND SellPrice<=BuyPrice, BuyPrice,SellStop1);

BuyStop=IIf((NOT BuyTP2),BuyStop2,Null);
BuyTP=IIf(NOT BuyStop,BuyTP2,Null);

Bars = DayOfWeek(); // day of week is equal to bars since new week.

x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
TOP_Line = LineArray(x0,LastValue(TOP),x1,LastValue(TOP),0);
PDH_Line = LineArray(x0,LastValue(PDH),x1,LastValue(PDH),0);
PDL_Line = LineArray(x0,LastValue(PDL),x1,LastValue(PDL),0);
PDC_Line = LineArray(x0,LastValue(PDC),x1,LastValue(PDC),0);
PDM_Line = LineArray(x0,LastValue(PDM),x1,LastValue(PDM),0);
FHH_Line = LineArray(x0,LastValue(FHH),x1,LastValue(FHH),0);
FHL_Line = LineArray(x0,LastValue(FHL),x1,LastValue(FHL),0);
BuyPriceline=LineArray(x0,LastValue(BuyPrice),x1,LastValue(BuyPrice),0);
BuyStopline=LineArray(x0,LastValue(BuyStop2),x1,LastValue(BuyStop2),0);
BuyTPline=LineArray(x0,LastValue(BuyTP1),x1,LastValue(BuyTP1),0);
SellPriceline=LineArray(x0,LastValue(SellPrice),x1 ,LastValue(SellPrice),0);
SellStopline=LineArray(x0,LastValue(SellStop2),x1, LastValue(SellStop2),0);
SellTPline=LineArray(x0,LastValue(SellTP1),x1,LastValue(SellTP1),0);
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);


Plot(IIf(pShowtradeLines,BuyStopline,Null),"BuyStop",colorBrightGreen,styleDots|styleNoRescale| styleNoLine);
Plot(IIf(pShowtradeLines,SellPriceline,Null),"Short Here",colorRed,styleDots|styleNoRescale);



_SECTION_END();
 

amitrandive

Well-Known Member
Re: Help required for correction of my AFL

Dear Friends,

Just saw this thread and surprised that people are helping each other with great lengths!!

I request thread owner Happy Singh or other programmers to correct my AFL also. I don't have any knowledge of programming. I want to use the Price in the forms of BARS with just HIGH LOW and CLOSE. Problem with my AFL is that it is making some kind of loop automatically and second it plots OPEN price in either in the top or lower most section of chart pane / window. I am

_SECTION_BEGIN("Price");
_SECTION_BEGIN ( "Price-Open with Color" );
.
.

_SECTION_END();
Use this,currently eliminates the plotting of the open .
Changing the thickness of bar, starts plotting the open again.

Code:
_SECTION_BEGIN ( "Price-Open with Color" );
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst);
SetChartOptions(0,chartShowArrows|chartShowDates);
Color = IIf(Prev_Close < C, ParamColor("Up Color", colorTurquoise ), ParamColor("Down Color", ColorRGB(239,250,41)));
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Strategic Investments Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));

PlotOHLC(Null,H, L, C, "", Color, styleBar, Null, Null, 0, 1,-10 /* line width as percent of bar */ );
_SECTION_END();
 

amitrandive

Well-Known Member
@ amitrandive ...

Hello Bro ...

You made this afl few days back needed some more additions to it ...
1. I need todays open in this .
2. If the candles can be drawn as thick .

_SECTION_BEGIN("Price1");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
ParamColor("BgTop",colorBlack),ParamColor("BgBottom",colorBlack),ParamColor("Titleblock",colorLightGrey));
SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);
GraphXSpace = 5;
Plot(C,"",colorWhite,styleCandle);
_SECTION_END();


PlotText(" Day Lo " , LastValue(BarIndex())-(numbars/Hts), DayLlineI +0.05, colorRed);
}



Regards ...
Sumit Lama :)
Added Today's open in Previous Day,High,Low ,Close parameter.
Not sure about your 2nd requirement.

Do you want thick lines as shown in your chart or thicker candles?


Code:
_SECTION_BEGIN("Price1");
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

//Previous Days HI LO CL//

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily);DayOI = LastValue (DayO,0);// current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayC2= TimeFrameGetPrice("C", inDaily, -2); DayC2I = LastValue (DayC2,1); // Two days before close
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low
DayC3= TimeFrameGetPrice("C", inDaily, -3); DayC3I = LastValue (DayC3,1); // Three days before close
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("PreviousDay HI LO CL Today Open","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"PDH",colorBlue,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC,"PDC",colorDarkRed,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayO,"Today Open",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
PlotText(" PDH " , LastValue(BarIndex())-25, DayHI+1, colorBlue);
PlotText(" PDL " , LastValue(BarIndex())-25, DayLI+1, colorRed);
PlotText(" PDC " , LastValue(BarIndex())-25, DayCI+1, colorDarkRed);
PlotText("Today Open" , LastValue(BarIndex())-25, DayOI+1, colorWhite);
}

TDBHL = ParamToggle("2/3Days before HI LO CL","Show|Hide",1);
if(TDBHL==1) {
Plot(DayL2,"2DBL",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH2,"2DBH",colorGreen,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayC2,"2DBC",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC3,"3DBC",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" 2DBH " , LastValue(BarIndex())-25, DayH2I+1, colorGreen);
PlotText(" 2DBL " , LastValue(BarIndex())-25, DayL2I+1, colorOrange);
PlotText(" 2DBC " , LastValue(BarIndex())-25, DayC2I+1, colorWhite);
PlotText(" 3DBH " , LastValue(BarIndex())-25, DayH3I+1, colorTurquoise);
PlotText(" 3DBL " , LastValue(BarIndex())-25, DayL3I+1, colorTurquoise);
PlotText(" 3DBC " , LastValue(BarIndex())-25, DayC3I+1, colorTurquoise);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot
R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1
S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1
R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2
S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2
R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3
S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1) {
Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

PlotText(" Pivot ", LastValue(BarIndex())-25, PPI+1, colorYellow);
PlotText(" R1 " , LastValue(BarIndex())-25, R1I+1, colorViolet);
PlotText(" S1 " , LastValue(BarIndex())-25, S1I+1, colorViolet);
PlotText(" R2 " , LastValue(BarIndex())-25, R2I+1, colorViolet);
PlotText(" S2 " , LastValue(BarIndex())-25, S2I+1, colorViolet);
PlotText(" R3 " , LastValue(BarIndex())-25, R3I+1, colorViolet);
PlotText(" S3 " , LastValue(BarIndex())-25, S3I+1, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg; H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2; H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4; H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6; H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12; H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12; L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6; L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4; L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2; L4I = LastValue (L4,1);
L5=DayC-1.1*rg; L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1) {
Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" H5 = " , LastValue(BarIndex())-25, H5I +0.05, colorRose);
PlotText(" H4 = " , LastValue(BarIndex())-25, H4I +0.05, colorRose);
PlotText(" H3 = " , LastValue(BarIndex())-25, H3I +0.05, colorRose);
PlotText(" H2 = " , LastValue(BarIndex())-25, H2I +0.05, colorRose);
PlotText(" H1 = " , LastValue(BarIndex())-25, H1I +0.05, colorRose);
PlotText(" L1 = " , LastValue(BarIndex())-25, L1I +0.05, colorRose);
PlotText(" L2 = " , LastValue(BarIndex())-25, L2I +0.05, colorRose);
PlotText(" L3 = " , LastValue(BarIndex())-25, L3I +0.05, colorRose);
PlotText(" L4 = " , LastValue(BarIndex())-25, L4I +0.05, colorRose);
PlotText(" L5 = " , LastValue(BarIndex())-25, L5I +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1) {
isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
isdRth = TimeNum() >= 084500 & TimeNum() <= 235900;
aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
DayHlineI = LastValue (DayHline,1);
DayLlineI = LastValue (DayLline,1);
Plot(DayHline,"DayH",colorBlue,styleBar|styleNoRescale|styleNoTitle);
Plot(DayLline,"DayL",colorRed,styleBar|styleNoRescale|styleNoTitle);
PlotText(" Day Hi " , LastValue(BarIndex())-30, DayHlineI +0.05, colorBlue);
PlotText(" Day Lo " , LastValue(BarIndex())-30, DayLlineI +0.05, colorRed);
}
 

cellclinic

Well-Known Member
Thanks Amit for the solution :) I need not the thick lines as i feel it will then retrace from previous day instead of intraday drawing . My request is for candlestick thickness if possible like a post here which is showing thickened bar chart .

Also Kindly check this error message ...



Added Today's open in Previous Day,High,Low ,Close parameter.
Not sure about your 2nd requirement.

Do you want thick lines as shown in your chart or thicker candles?


Code:
_SECTION_BEGIN("Price1");
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

//Previous Days HI LO CL//

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily);DayOI = LastValue (DayO,0);// current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayC2= TimeFrameGetPrice("C", inDaily, -2); DayC2I = LastValue (DayC2,1); // Two days before close
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low
DayC3= TimeFrameGetPrice("C", inDaily, -3); DayC3I = LastValue (DayC3,1); // Three days before close
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("PreviousDay HI LO CL Today Open","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"PDH",colorBlue,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC,"PDC",colorDarkRed,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayO,"Today Open",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
PlotText(" PDH " , LastValue(BarIndex())-25, DayHI+1, colorBlue);
PlotText(" PDL " , LastValue(BarIndex())-25, DayLI+1, colorRed);
PlotText(" PDC " , LastValue(BarIndex())-25, DayCI+1, colorDarkRed);
PlotText("Today Open" , LastValue(BarIndex())-25, DayOI+1, colorWhite);
}

TDBHL = ParamToggle("2/3Days before HI LO CL","Show|Hide",1);
if(TDBHL==1) {
Plot(DayL2,"2DBL",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH2,"2DBH",colorGreen,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayC2,"2DBC",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC3,"3DBC",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" 2DBH " , LastValue(BarIndex())-25, DayH2I+1, colorGreen);
PlotText(" 2DBL " , LastValue(BarIndex())-25, DayL2I+1, colorOrange);
PlotText(" 2DBC " , LastValue(BarIndex())-25, DayC2I+1, colorWhite);
PlotText(" 3DBH " , LastValue(BarIndex())-25, DayH3I+1, colorTurquoise);
PlotText(" 3DBL " , LastValue(BarIndex())-25, DayL3I+1, colorTurquoise);
PlotText(" 3DBC " , LastValue(BarIndex())-25, DayC3I+1, colorTurquoise);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot
R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1
S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1
R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2
S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2
R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3
S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1) {
Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

PlotText(" Pivot ", LastValue(BarIndex())-25, PPI+1, colorYellow);
PlotText(" R1 " , LastValue(BarIndex())-25, R1I+1, colorViolet);
PlotText(" S1 " , LastValue(BarIndex())-25, S1I+1, colorViolet);
PlotText(" R2 " , LastValue(BarIndex())-25, R2I+1, colorViolet);
PlotText(" S2 " , LastValue(BarIndex())-25, S2I+1, colorViolet);
PlotText(" R3 " , LastValue(BarIndex())-25, R3I+1, colorViolet);
PlotText(" S3 " , LastValue(BarIndex())-25, S3I+1, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg; H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2; H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4; H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6; H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12; H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12; L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6; L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4; L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2; L4I = LastValue (L4,1);
L5=DayC-1.1*rg; L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1) {
Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" H5 = " , LastValue(BarIndex())-25, H5I +0.05, colorRose);
PlotText(" H4 = " , LastValue(BarIndex())-25, H4I +0.05, colorRose);
PlotText(" H3 = " , LastValue(BarIndex())-25, H3I +0.05, colorRose);
PlotText(" H2 = " , LastValue(BarIndex())-25, H2I +0.05, colorRose);
PlotText(" H1 = " , LastValue(BarIndex())-25, H1I +0.05, colorRose);
PlotText(" L1 = " , LastValue(BarIndex())-25, L1I +0.05, colorRose);
PlotText(" L2 = " , LastValue(BarIndex())-25, L2I +0.05, colorRose);
PlotText(" L3 = " , LastValue(BarIndex())-25, L3I +0.05, colorRose);
PlotText(" L4 = " , LastValue(BarIndex())-25, L4I +0.05, colorRose);
PlotText(" L5 = " , LastValue(BarIndex())-25, L5I +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1) {
isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
isdRth = TimeNum() >= 084500 & TimeNum() <= 235900;
aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
DayHlineI = LastValue (DayHline,1);
DayLlineI = LastValue (DayLline,1);
Plot(DayHline,"DayH",colorBlue,styleBar|styleNoRescale|styleNoTitle);
Plot(DayLline,"DayL",colorRed,styleBar|styleNoRescale|styleNoTitle);
PlotText(" Day Hi " , LastValue(BarIndex())-30, DayHlineI +0.05, colorBlue);
PlotText(" Day Lo " , LastValue(BarIndex())-30, DayLlineI +0.05, colorRed);
}
 
Last edited:

amitrandive

Well-Known Member
Thanks Amit for the solution :) I need not the thick lines as i feel it will then retrace from previous day instead of intraday drawing . My request is for candlestick thickness if possible like a post here which is showing thickened bar chart .

Also Kindly check this error message ...




Cellclinic
Error is due to incorrect pasting of code.A Brace bracket is missing at the end of the code.

Latest code includes thicker candles.


Code:
_SECTION_BEGIN("Price1");
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 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
barbodycolor=IIf(C>O,colorGreen,colorRed);
SetBarFillColor(barbodycolor);//setting color for bar body(vertical line without open and close handles).
PlotOHLC( Null,H,L,C, "bar", colorBlack,styleBar,Null,Null,0,0,2 ); //setting color for bar's open and close handle.
SetBarFillColor(barbodycolor);//setting color for candlestick body.
Plot( C, "Close", barbodycolor,styleCandle,Null,Null,0,1,2 ); //setting color for candlestick shadows._SECTION_END();

//Previous Days HI LO CL//

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily);DayOI = LastValue (DayO,0);// current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayC2= TimeFrameGetPrice("C", inDaily, -2); DayC2I = LastValue (DayC2,1); // Two days before close
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low
DayC3= TimeFrameGetPrice("C", inDaily, -3); DayC3I = LastValue (DayC3,1); // Three days before close
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("PreviousDay HI LO CL Today Open","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"PDH",colorBlue,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC,"PDC",colorDarkRed,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayO,"Today Open",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
PlotText(" PDH " , LastValue(BarIndex())-25, DayHI+1, colorBlue);
PlotText(" PDL " , LastValue(BarIndex())-25, DayLI+1, colorRed);
PlotText(" PDC " , LastValue(BarIndex())-25, DayCI+1, colorDarkRed);
PlotText("Today Open" , LastValue(BarIndex())-25, DayOI+1, colorWhite);
}

TDBHL = ParamToggle("2/3Days before HI LO CL","Show|Hide",1);
if(TDBHL==1) {
Plot(DayL2,"2DBL",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH2,"2DBH",colorGreen,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayC2,"2DBC",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC3,"3DBC",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" 2DBH " , LastValue(BarIndex())-25, DayH2I+1, colorGreen);
PlotText(" 2DBL " , LastValue(BarIndex())-25, DayL2I+1, colorOrange);
PlotText(" 2DBC " , LastValue(BarIndex())-25, DayC2I+1, colorWhite);
PlotText(" 3DBH " , LastValue(BarIndex())-25, DayH3I+1, colorTurquoise);
PlotText(" 3DBL " , LastValue(BarIndex())-25, DayL3I+1, colorTurquoise);
PlotText(" 3DBC " , LastValue(BarIndex())-25, DayC3I+1, colorTurquoise);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot
R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1
S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1
R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2
S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2
R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3
S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1) {
Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

PlotText(" Pivot ", LastValue(BarIndex())-25, PPI+1, colorYellow);
PlotText(" R1 " , LastValue(BarIndex())-25, R1I+1, colorViolet);
PlotText(" S1 " , LastValue(BarIndex())-25, S1I+1, colorViolet);
PlotText(" R2 " , LastValue(BarIndex())-25, R2I+1, colorViolet);
PlotText(" S2 " , LastValue(BarIndex())-25, S2I+1, colorViolet);
PlotText(" R3 " , LastValue(BarIndex())-25, R3I+1, colorViolet);
PlotText(" S3 " , LastValue(BarIndex())-25, S3I+1, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg; H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2; H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4; H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6; H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12; H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12; L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6; L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4; L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2; L4I = LastValue (L4,1);
L5=DayC-1.1*rg; L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1) {
Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" H5 = " , LastValue(BarIndex())-25, H5I +0.05, colorRose);
PlotText(" H4 = " , LastValue(BarIndex())-25, H4I +0.05, colorRose);
PlotText(" H3 = " , LastValue(BarIndex())-25, H3I +0.05, colorRose);
PlotText(" H2 = " , LastValue(BarIndex())-25, H2I +0.05, colorRose);
PlotText(" H1 = " , LastValue(BarIndex())-25, H1I +0.05, colorRose);
PlotText(" L1 = " , LastValue(BarIndex())-25, L1I +0.05, colorRose);
PlotText(" L2 = " , LastValue(BarIndex())-25, L2I +0.05, colorRose);
PlotText(" L3 = " , LastValue(BarIndex())-25, L3I +0.05, colorRose);
PlotText(" L4 = " , LastValue(BarIndex())-25, L4I +0.05, colorRose);
PlotText(" L5 = " , LastValue(BarIndex())-25, L5I +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1) {
isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
isdRth = TimeNum() >= 084500 & TimeNum() <= 235900;
aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
DayHlineI = LastValue (DayHline,1);
DayLlineI = LastValue (DayLline,1);
Plot(DayHline,"DayH",colorBlue,styleBar|styleNoRescale|styleNoTitle);
Plot(DayLline,"DayL",colorRed,styleBar|styleNoRescale|styleNoTitle);
PlotText(" Day Hi " , LastValue(BarIndex())-30, DayHlineI +0.05, colorBlue);
PlotText(" Day Lo " , LastValue(BarIndex())-30, DayLlineI +0.05, colorRed);
}
 

cellclinic

Well-Known Member
Day Open Still Missing In AFL ... PLz Check ...




Cellclinic
Error is due to incorrect pasting of code.A Brace bracket is missing at the end of the code.

Latest code includes thicker candles.


Code:
_SECTION_BEGIN("Price1");
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 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
barbodycolor=IIf(C>O,colorGreen,colorRed);
SetBarFillColor(barbodycolor);//setting color for bar body(vertical line without open and close handles).
PlotOHLC( Null,H,L,C, "bar", colorBlack,styleBar,Null,Null,0,0,2 ); //setting color for bar's open and close handle.
SetBarFillColor(barbodycolor);//setting color for candlestick body.
Plot( C, "Close", barbodycolor,styleCandle,Null,Null,0,1,2 ); //setting color for candlestick shadows._SECTION_END();

//Previous Days HI LO CL//

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily);DayOI = LastValue (DayO,0);// current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayC2= TimeFrameGetPrice("C", inDaily, -2); DayC2I = LastValue (DayC2,1); // Two days before close
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low
DayC3= TimeFrameGetPrice("C", inDaily, -3); DayC3I = LastValue (DayC3,1); // Three days before close
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("PreviousDay HI LO CL Today Open","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"PDH",colorBlue,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC,"PDC",colorDarkRed,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayO,"Today Open",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
PlotText(" PDH " , LastValue(BarIndex())-25, DayHI+1, colorBlue);
PlotText(" PDL " , LastValue(BarIndex())-25, DayLI+1, colorRed);
PlotText(" PDC " , LastValue(BarIndex())-25, DayCI+1, colorDarkRed);
PlotText("Today Open" , LastValue(BarIndex())-25, DayOI+1, colorWhite);
}

TDBHL = ParamToggle("2/3Days before HI LO CL","Show|Hide",1);
if(TDBHL==1) {
Plot(DayL2,"2DBL",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH2,"2DBH",colorGreen,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayC2,"2DBC",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC3,"3DBC",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" 2DBH " , LastValue(BarIndex())-25, DayH2I+1, colorGreen);
PlotText(" 2DBL " , LastValue(BarIndex())-25, DayL2I+1, colorOrange);
PlotText(" 2DBC " , LastValue(BarIndex())-25, DayC2I+1, colorWhite);
PlotText(" 3DBH " , LastValue(BarIndex())-25, DayH3I+1, colorTurquoise);
PlotText(" 3DBL " , LastValue(BarIndex())-25, DayL3I+1, colorTurquoise);
PlotText(" 3DBC " , LastValue(BarIndex())-25, DayC3I+1, colorTurquoise);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot
R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1
S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1
R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2
S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2
R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3
S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1) {
Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

PlotText(" Pivot ", LastValue(BarIndex())-25, PPI+1, colorYellow);
PlotText(" R1 " , LastValue(BarIndex())-25, R1I+1, colorViolet);
PlotText(" S1 " , LastValue(BarIndex())-25, S1I+1, colorViolet);
PlotText(" R2 " , LastValue(BarIndex())-25, R2I+1, colorViolet);
PlotText(" S2 " , LastValue(BarIndex())-25, S2I+1, colorViolet);
PlotText(" R3 " , LastValue(BarIndex())-25, R3I+1, colorViolet);
PlotText(" S3 " , LastValue(BarIndex())-25, S3I+1, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg; H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2; H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4; H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6; H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12; H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12; L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6; L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4; L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2; L4I = LastValue (L4,1);
L5=DayC-1.1*rg; L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1) {
Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" H5 = " , LastValue(BarIndex())-25, H5I +0.05, colorRose);
PlotText(" H4 = " , LastValue(BarIndex())-25, H4I +0.05, colorRose);
PlotText(" H3 = " , LastValue(BarIndex())-25, H3I +0.05, colorRose);
PlotText(" H2 = " , LastValue(BarIndex())-25, H2I +0.05, colorRose);
PlotText(" H1 = " , LastValue(BarIndex())-25, H1I +0.05, colorRose);
PlotText(" L1 = " , LastValue(BarIndex())-25, L1I +0.05, colorRose);
PlotText(" L2 = " , LastValue(BarIndex())-25, L2I +0.05, colorRose);
PlotText(" L3 = " , LastValue(BarIndex())-25, L3I +0.05, colorRose);
PlotText(" L4 = " , LastValue(BarIndex())-25, L4I +0.05, colorRose);
PlotText(" L5 = " , LastValue(BarIndex())-25, L5I +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1) {
isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
isdRth = TimeNum() >= 084500 & TimeNum() <= 235900;
aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
DayHlineI = LastValue (DayHline,1);
DayLlineI = LastValue (DayLline,1);
Plot(DayHline,"DayH",colorBlue,styleBar|styleNoRescale|styleNoTitle);
Plot(DayLline,"DayL",colorRed,styleBar|styleNoRescale|styleNoTitle);
PlotText(" Day Hi " , LastValue(BarIndex())-30, DayHlineI +0.05, colorBlue);
PlotText(" Day Lo " , LastValue(BarIndex())-30, DayLlineI +0.05, colorRed);
}
 

amitrandive

Well-Known Member
Day Open Still Missing In AFL ... PLz Check ...

CellClinic

Do not go on adding to the existing AFL.Completely replace the new code in a Blank AFL.After adding the code, click on "Reset All" of parameters window.
Today's open is there , check again
Read This
Originally Posted by amitrandive
Added Today's open in Previous Day,High,Low ,Close parameter.
 

Similar threads