Simple Coding Help - No Promise.

cellclinic

Well-Known Member
I created new afl only & pasted complete new code in it ... after doing reset all this is the position on chart ...

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.

Read This
 

amitrandive

Well-Known Member
I created new afl only & pasted complete new code in it ... after doing reset all this is the position on chart ...
Got the issue.Your white background causes the line to seem invisible.
Now check this code.Have changed the color of the line.

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",colorBlack,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, colorBlack);
}

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",colorAqua,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, colorAqua);
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 :clapping: ... A little final request ... In first ( new formulla ) not showing Names in the end of Line like second ( old formula ) Kindly adjust that & 2nd Today Open Font is to be increased Like others & also if i can het 5 dots right extension on each line ... :)





Got the issue.Your white background causes the line to seem invisible.
Now check this code.Have changed the color of the line.

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",colorBlack,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, colorBlack);
}

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",colorAqua,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, colorAqua);
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 :clapping: ... A little final request ... In first ( new formulla ) not showing Names in the end of Line like second ( old formula ) Kindly adjust that & 2nd Today Open Font is to be increased Like others & also if i can het 5 dots right extension on each line ... :)



Modified the font of "Today Open".
Regarding the location of the text, I have already clarified in this post
http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-148.html#post964309

The 3rd requirement is beyond me.I tried to add a "Fwd" factor to the line plot , but then it would have to use an array to extend that line to the right.
Not sure how to do that.

Need expert guidance
Tried this , but does not work.
Code:
Fwd  = Param("Plot Forward", 0, 0, 500, 1);
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle|Fwd)



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",colorBlack,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, colorBlack);
}

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",colorAqua,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, colorAqua);
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);
}
 
Thank you all for your hard work, Amibrocer code for ndx is different than the metatrader version,
what's the problem ?,
I guess the problem could tema in amibroker. please help me and , do fix it. Thank you

//metatrader code for ocean ndx
.
.
.

for(i = limit; i >= 0; i--)

{
double SumWght = 0, SumDnom = 0, DifAry, DnomAry, FracAry, TimeAry, WgtAry;
for(ii = 1; ii <= NDX_period; ii++)
{
DifAry = MathLog(Close[i+ii-1]) - MathLog(Close[i+ii]);
if(ii == 1) DnomAry = MathAbs(DifAry); else DnomAry += MathAbs(DifAry);
if(DnomAry == 0) FracAry = 0; else FracAry = (MathLog(Close) - MathLog(Close[i+ii])) / DnomAry;
TimeAry = 1 / MathPow(ii, 0.5);
WgtAry = FracAry * TimeAry;
SumWght += WgtAry;
SumDnom += TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;
}
double ExpSmooth = 2, XAvg1, XAvg2, XAvg3;
ExpSmooth = ExpSmooth / (SmLen + 1);
for(i = bars - NDX_period - 1; i >= 0; i--)
{
XAvg1 += ExpSmooth * (RawNDX - XAvg1);
XAvg2 += ExpSmooth * (XAvg1 - XAvg2);
XAvg3 += ExpSmooth * (XAvg2 - XAvg3);
maNDX = 3 * XAvg1 - 3 * XAvg2 + XAvg3;
if(i < bars - NDX_period - 1 - 3*SmLen)
{
if(maNDX > 90) NDX = MathRound(90 + (maNDX - 90) / 2);
else if(maNDX < -90) NDX = MathRound(-90 - (MathAbs(maNDX) - 90) / 2);
else NDX = MathRound(maNDX);
}
}

.
.
.

//amibrocer code for ocean ndx

NDX_period = Param("NDX Period",75,40,375);
NDX_SmLen = round(NDX_Period*20/40);


SumWght = 0;
SumDnom = 0;

for(i = 1; i < NDX_period+1; i++)
{
DifAry = ln(Ref(Close,-i+1)) - ln(Ref(Close,-i));
if(i == 1)
DnomAry = abs(DifAry);
else
DnomAry =DNomAry+ abs(DifAry);
FracAry =IIf(DNomAry==0, 0,(ln(Close) - ln(Ref(Close,-i))) / DnomAry);
TimeAry = 1 / (i^( 0.5));
WghtAry = FracAry * TimeAry;
SumWght =SumWght+ WghtAry;
SumDnom =SumDnom+ TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;

TemaNDX= TEMA(RawNDX,NDX_SmLen);

Plot(TemaNDX,"NDX",colorRed,styleLine);
 
Dear All,

_SECTION_BEGIN("EMA200_TEST");
TimeFrameSet(in1Minute);
y= EMA(C,200) ;

DHlineI = LastValue (y,1);
Plot( TimeFrameCompress( y, in1Minute, compressLast ) ,"EMA200", colorWhite,styleLine);
TimeFrameRestore();
_SECTION_END();

I am having this function, I want to 1min 200EMA on 15 min Chart. But above function not giving the correct result. Please help to modify the above formula.

I am trading on 15min chart but I want EMA on 1 min. time frame on 15min chart.

Thanks in advance,

Maruti Mane
 

Nehal_s143

Well-Known Member
Hi

tried to make afl similar to above image, very near to it but not exact,
logic is take trade only if price is near 200 ema (as price always try to come near 200 ema if it goes far away, risk is less near 200 ema)
and
take only longs if price above 200 ema and
take only shorts if price below 200 ema (trading in direction of larger trend, which is here 200 ema)




Please send your feedback and suggestion on how we can improve more
 
Last edited:
I think it would be very easy for you to do please help me,


Thank you all for your hard work, Amibrocer code for ndx is different than the metatrader version,
what's the problem ?,
I guess the problem could tema in amibroker. please help me and , do fix it. Thank you

//metatrader code for ocean ndx
.
.
.

for(i = limit; i >= 0; i--)

{
double SumWght = 0, SumDnom = 0, DifAry, DnomAry, FracAry, TimeAry, WgtAry;
for(ii = 1; ii <= NDX_period; ii++)
{
DifAry = MathLog(Close[i+ii-1]) - MathLog(Close[i+ii]);
if(ii == 1) DnomAry = MathAbs(DifAry); else DnomAry += MathAbs(DifAry);
if(DnomAry == 0) FracAry = 0; else FracAry = (MathLog(Close) - MathLog(Close[i+ii])) / DnomAry;
TimeAry = 1 / MathPow(ii, 0.5);
WgtAry = FracAry * TimeAry;
SumWght += WgtAry;
SumDnom += TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;
}
double ExpSmooth = 2, XAvg1, XAvg2, XAvg3;
ExpSmooth = ExpSmooth / (SmLen + 1);
for(i = bars - NDX_period - 1; i >= 0; i--)
{
XAvg1 += ExpSmooth * (RawNDX - XAvg1);
XAvg2 += ExpSmooth * (XAvg1 - XAvg2);
XAvg3 += ExpSmooth * (XAvg2 - XAvg3);
maNDX = 3 * XAvg1 - 3 * XAvg2 + XAvg3;
if(i < bars - NDX_period - 1 - 3*SmLen)
{
if(maNDX > 90) NDX = MathRound(90 + (maNDX - 90) / 2);
else if(maNDX < -90) NDX = MathRound(-90 - (MathAbs(maNDX) - 90) / 2);
else NDX = MathRound(maNDX);
}
}
.
.
.

//amibrocer code for ocean ndx

NDX_period = Param("NDX Period",75,40,375);
NDX_SmLen = round(NDX_Period*20/40);


SumWght = 0;
SumDnom = 0;

for(i = 1; i < NDX_period+1; i++)
{
DifAry = ln(Ref(Close,-i+1)) - ln(Ref(Close,-i));
if(i == 1)
DnomAry = abs(DifAry);
else
DnomAry =DNomAry+ abs(DifAry);
FracAry =IIf(DNomAry==0, 0,(ln(Close) - ln(Ref(Close,-i))) / DnomAry);
TimeAry = 1 / (i^( 0.5));
WghtAry = FracAry * TimeAry;
SumWght =SumWght+ WghtAry;
SumDnom =SumDnom+ TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;

TemaNDX= TEMA(RawNDX,NDX_SmLen);

Plot(TemaNDX,"NDX",colorRed,styleLine);
 

cellclinic

Well-Known Member
Hello Amit ... It was actually located in previous afl both on top & @ end . might be need to write same formula 2 times & to shift 2nd parameters as fit to end ...

Hello amibroker formula Experts ... I need this afl to get all lines drawn on open @ least 5 dots advanced to get proper reading of open high low close as when market opens on very first bar i am unable to view the single dot for each parameter .

Modified the font of "Today Open".
Regarding the location of the text, I have already clarified in this post
http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-148.html#post964309

The 3rd requirement is beyond me.I tried to add a "Fwd" factor to the line plot , but then it would have to use an array to extend that line to the right.
Not sure how to do that.

Need expert guidance
Tried this , but does not work.
Code:
Fwd  = Param("Plot Forward", 0, 0, 500, 1);
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle|Fwd)



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",colorBlack,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, colorBlack);
}

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",colorAqua,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, colorAqua);
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);
}
 

Similar threads