_SECTION_BEGIN("Trendlines Multitimeframe- tweaked by SR114 - do not leave this line");
// Amibroker AFL code by Edward Pottasch, 6/8/2011
// Using fractals to create automatic trendlines
// Using option to show multiple timeframes
SetChartOptions(0,chartShowArrows|chartShowDates);
Version(5.21);
xx=BarIndex();x=xx;Lx=LastValue(x);
nbar=Param("N Pivot Bars",3,2,50,1);
tf=Param("Time Frame (min)",5,1,100000,1);tfrm=in1Minute*tf;
CleanPivots=ParamToggle("Use Clean Pivots","Off|On",0);
PivotSymmetry=ParamToggle("Use Symmetric Pivots","Off|On",0);
tld=ParamToggle("All trendlines","Show|Hide",1);
showSignals=ParamToggle("Display signals","Off|On",0);
TimeFrameSet(tfrm);
if (PivotSymmetry)
{
fc=1;
pk=H>Ref(HHV(H,nbar*fc),-1) AND Ref(HHV(H,nbar),nbar)<=H;
tr=L<Ref(LLV(L,nbar*fc),-1) AND Ref(LLV(L,nbar),nbar)>=L;
}
else
{
fc=2;
pk=H>Ref(HHV(H,nbar*fc),-1) AND Ref(HHV(H,nbar),nbar)<=H;
tr=L<Ref(LLV(L,nbar*fc),-1) AND Ref(LLV(L,nbar),nbar)>=L;
}
px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
if (CleanPivots)
{
tr=IIf(pk AND tr AND ph1>ph2 AND tl1>tl2,False,tr);
pk=IIf(pk AND tr AND ph1<ph2 AND tl1<tl2,False,pk);
px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
pk=IIf(pk AND px1>tx1 AND ph1<tl1,False,pk);
tr=IIf(tr AND tx1>px1 AND tl1>ph1,False,tr);
pk=IIf(pk AND px0<tx0 AND ph0>ph1,False,pk);
tr=IIf(tr AND px0>tx0 AND tl0<tl1,False,tr);
pk=IIf(pk AND px2>tx1 AND ph1<=ph2,False,pk);
tr=IIf(tr AND tx2>px1 AND tl1>=tl2,False,tr);
pk=IIf(pk AND px0>px1 AND px1>tx1 AND px1>tx0 AND ph0>ph1,False,pk);
tr=IIf(tr AND tx0>tx1 AND tx1>px1 AND tx1>px0 AND tl0<tl1,False,tr);
px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
pk=IIf(pk AND px1>tx1 AND ph1<tl1,False,pk);
tr=IIf(tr AND tx1>px1 AND tl1>ph1,False,tr);
pk=IIf(pk AND px0<tx0 AND ph0>ph1,False,pk);
tr=IIf(tr AND px0>tx0 AND tl0<tl1,False,tr);
pk=IIf(pk AND px2>tx1 AND ph1<=ph2,False,pk);
tr=IIf(tr AND tx2>px1 AND tl1>=tl2,False,tr);
pk=IIf(pk AND px0>px1 AND px1>tx1 AND px1>tx0 AND ph0>ph1,False,pk);
tr=IIf(tr AND tx0>tx1 AND tx1>px1 AND tx1>px0 AND tl0<tl1,False,tr);
px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
pk=IIf(pk AND px1>tx1 AND px2>tx1 AND ph1<ph2,False,pk);
tr=IIf(tr AND tx1>px1 AND tx2>px1 AND tl1>tl2,False,tr);
}
pkh=IIf(pk,H,Null);
trl=IIf(tr,L,Null);
TimeFrameRestore();
fact=Max(tfrm/60,Interval()/60)/(Interval()/60);
Lkbk=tfrm/Interval();
if(Lkbk>1)
{
pk=TimeFrameExpand(pk,tfrm,expandFirst);
pkh=TimeFrameExpand(pkh,tfrm,expandFirst);
pkhs=IIf(!IsEmpty(pkh),1,0);pkhs=pkhs-Ref(pkhs,-1);
pk=pk AND H==pkh;
cond1=Sum(pk,BarsSince(pkhs==1)+1)==1 AND pk;
pk=pk AND cond1;
tr=TimeFrameExpand(tr,tfrm,expandFirst);
trl=TimeFrameExpand(trl,tfrm,expandFirst);
trls=IIf(!IsEmpty(trl),1,0);trls=trls-Ref(trls,-1);
tr=tr AND L==trl;
cond1=Sum(tr,BarsSince(trls==1)+1)==1 AND tr;
tr=tr AND cond1;
px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
}
y0=ValueWhen(tr,trl,0);
y1=ValueWhen(tr,trl,1);
y2=ValueWhen(tr,trl,2);
y3=ValueWhen(tr,trl,3);
x0=ValueWhen(tr,xx,0);
x1=ValueWhen(tr,xx,1);
x2=ValueWhen(tr,xx,2);
x3=ValueWhen(tr,xx,3);
aa=(Y0-Y1)/(X0-X1);
ls1=aa*(xx-X1)+Y1;
dls1=ls1-Ref(ls1,-1);
aa=(Y1-Y2)/(X1-X2);
ls2=aa*(xx-X1)+Y1;
dls2=ls2-Ref(ls2,-1);
dls2=IIf(tr,Ref(dls1,-1),dls2);
aa=(Y2-Y3)/(X2-X3);
ls3=aa*(xx-X2)+Y2;
dls3=ls3-Ref(ls3,-1);
dls3=IIf(tr,Ref(dls2,-1),dls3);
y0=ValueWhen(pk,pkh,0);
y1=ValueWhen(pk,pkh,1);
y2=ValueWhen(pk,pkh,2);
y3=ValueWhen(pk,pkh,3);
x0=ValueWhen(pk,xx,0);
x1=ValueWhen(pk,xx,1);
x2=ValueWhen(pk,xx,2);
x3=ValueWhen(pk,xx,3);
aa=(Y0-Y1)/(X0-X1);
hs1=aa*(xx-X1)+Y1;
dhs1=hs1-Ref(hs1,-1);
aa=(Y1-Y2)/(X1-X2);
hs2=aa*(xx-X1)+Y1;
dhs2=hs2-Ref(hs2,-1);
dhs2=IIf(pk,Ref(dhs1,-1),dhs2);
aa=(Y2-Y3)/(X2-X3);
hs3=aa*(xx-X2)+Y2;
dhs3=hs3-Ref(hs3,-1);
dhs3=IIf(pk,Ref(dhs2,-1),dhs3);
if (tld)
{
dd=0.0;
Vh=dd*(ValueWhen(pk,C)-ValueWhen(pk,Ref(C,-1)))/ValueWhen(pk,C);
Vl=dd*(ValueWhen(tr,C)-ValueWhen(tr,Ref(C,-1)))/ValueWhen(tr,C);
ls1=IIf(dls1>=Vl,ls1,Null);
ls2=IIf(dls2>=Vl,ls2,Null);
ls3=IIf(dls3>=Vl,ls3,Null);
hs1=IIf(dhs1<=Vh,hs1,Null);
hs2=IIf(dhs2<=Vh,hs2,Null);
hs3=IIf(dhs3<=Vh,hs3,Null);
}
ls2a=IIf(BarsSince(tr)<=nbar*fact,ls2,Null);
ls2b=IIf(BarsSince(tr)>nbar*fact,ls2,Null);
ls3=IIf(BarsSince(tr)<=nbar*fact,ls3,Null);
hs2a=IIf(BarsSince(pk)<=nbar*fact,hs2,Null);
hs2b=IIf(BarsSince(pk)>nbar*fact,hs2,Null);
hs3=IIf(BarsSince(pk)<=nbar*fact,hs3,Null);
_SECTION_END();
_SECTION_BEGIN("Chart Colors");
SetChartBkColor(ParamColor("Background Color",ColorRGB(0,0,0)));
SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);
Plot(pkh,"",colorRed,styleThick,0,0,0,-1);
Plot(trl,"",colorBrightGreen,styleThick,0,0,0,-1);
PlotShapes(shapeSmallCircle*tr,IIf(Lx-ValueWhen(tr,x)>nbar*fact,ColorRGB(128,255,128),colorWhite),0,L,-10);
PlotShapes(shapeSmallCircle*pk,IIf(Lx-ValueWhen(pk,x)>nbar*fact,ColorRGB(255,0,0),colorWhite),0,H,10);
Plot(ls1,"\nLower Trendline",colorBrightGreen,styleLine,0,0,0,-1);
Plot(ls2a,"",colorLightGrey,styleNoLine|styleDots| styleThick,0,0,0,-1);
Plot(ls2b,"",colorBrightGreen,styleNoLine|styleDots| styleThick,0,0,0,-1);
Plot(ls3,"",colorBrightGreen,styleNoLine|styleDots|styleThick,0,0,0,-1);
Plot(hs1,"\nUpper Trendline",colorRed,styleLine,0,0,0,-1);
Plot(hs2a,"",colorLightGrey,styleNoLine|styleDots| styleThick,0,0,0,-1);
Plot(hs2b,"",colorOrange,styleNoLine|styleDots|styleThick,0,0,0,-1);
Plot(hs3,"",colorOrange,styleNoLine|styleDots|styleThick,0,0,0,-1);
_SECTION_END();
if(showSignals)
{
Buy=( (!IsEmpty(Ref(hs2b,-1)) AND Ref(C<hs2b,-1)) AND (!IsEmpty(hs2b) AND C>hs2b) )
OR ( (!IsEmpty(Ref(hs3,-1)) AND Ref(C<hs3,-1)) AND (!IsEmpty(hs3) AND C>hs3) )
OR ( (!IsEmpty(Ref(hs2b,-1)) AND Ref(C<hs2b,-1)) AND (!IsEmpty(hs3) AND C>hs3) );
Buy=ExRem(Buy,tr OR pk);
BuyPrice=C;
Short=( (!IsEmpty(Ref(ls2b,-1)) AND Ref(C>ls2b,-1)) AND (!IsEmpty(ls2b) AND C<ls2b) )
OR ( (!IsEmpty(Ref(ls3,-1)) AND Ref(C>ls3,-1)) AND (!IsEmpty(ls3) AND C<ls3) )
OR ( (!IsEmpty(Ref(ls2b,-1)) AND Ref(C>ls2b,-1)) AND (!IsEmpty(ls3) AND C<ls3) );
Short=ExRem(Short,tr OR pk);
ShortPrice=C;
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone) ,colorBrightGreen,0,L,-15);
PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);
PlotShapes(IIf(Short,shapeSmallDownTriangle,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Short,shapeSmallCircle,shapeNone),colorWhite,0,ShortPrice,0);
}
qq=Interval()/60;
if(qq < 60){tf=" min";tt=qq;}
else if(qq >= 60 AND qq < 1440){tf=" hrs";tt=qq/60;}
else if(qq >= 1440){tf=" days";tt=(qq/60)/24;}
qq=Max(tfrm/60,Interval()/60);
if(qq < 60){tfa=" min";tta=qq;}
else if(qq >= 60 AND qq < 1440){tfa=" hrs";tta=qq/60;}
else if(qq >= 1440){tfa=" days";tta=(qq/60)/24;}
Title = EncodeColor(colorWhite)+ Name() + EncodeColor(colorWhite)+
"\nNbar: " + nbar +
"\nChart TF: " + tt + tf +
"\nTrend TF: " + tta + tfa;
_SECTION_END();
_SECTION_BEGIN("Label");
disp=ParamToggle("Display labels","Off|On",1);
dxhm=Param("Shift X Highs (Margin)",14,-100,100,1);
dxlm=Param("Shift X Lows (Margin)",10,-100,100,1);
dxh=Param("Shift X Highs",0,-100,100,1);
dxl=Param("Shift X Lows",0,-100,100,1);
dyhm=Param("Shift Y Highs (Margin)",5,-100,100,1);
dylm=Param("Shift Y Lows (Margin)",3,-100,100,1);
dyh=Param("Shift Y Highs",18,-100,100,1);
dyl=Param("Shift Y Lows",29,-100,100,1);
hm=Param("Marging High",30,-100,100,1);
lm=Param("Margin Low",30,-100,100,1);
function GetVisibleBarCount()
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
return Min(lvb-fvb,BarCount-fvb);
}
function GfxConvertPixelsToBarX(Pixels)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
fac=pxchartwidth/Pixels;
bar=(lvb-fvb)/fac;
return bar;
}
function GfxConvertPixelToValueY(Pixels)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
fac=pxchartheight/Pixels;
Value=(Maxy-Miny)/fac;
return Value;
}
if(disp)
{
ll=tr AND tl1<tl2;
hl=tr AND tl1>tl2;
hh=pk AND ph1>ph2;
lh=pk AND ph1<ph2;
dt=pk AND ph1==ph2;
db=tr AND tl1==tl2;
PlotShapes(shapeHollowCircle*lh,ColorRGB(255,193,193),0,H,10);
PlotShapes(shapeHollowCircle*hl,ColorRGB(202,255,112),0,L,-10);
miny=Status("axisminy");
maxy=Status("axismaxy");
AllVisibleBars=GetVisibleBarCount();
fvb=Status("firstvisiblebar");
LowMargin=Miny+GfxConvertPixelToValueY(lm);
HighMargin=Maxy-GfxConvertPixelToValueY(hm);
dyllm=GfxConvertPixelToValueY(dylm);
dyhhm=GfxConvertPixelToValueY(dyhm);
dyll=GfxConvertPixelToValueY(dyl);
dyhh=GfxConvertPixelToValueY(dyh);
dxllm=GfxConvertPixelsToBarX(dxlm);
dxhhm=GfxConvertPixelsToBarX(dxhm);
dxll=GfxConvertPixelsToBarX(dxl);
dxhh=GfxConvertPixelsToBarX(dxh);
for(i=0;i<AllVisibleBars;i++)
{
if(ll[i+fvb] AND L[i+fvb]>LowMargin)
PlotText("L L",i+fvb+dxll,L[i+fvb]-dyll,colorWhite,colorBlack);
if(ll[i+fvb] AND L[i+fvb]<=LowMargin)
PlotText("L L",i+fvb+dxll+dxllm,L[i+fvb]-dyllm,colorWhite,colorBlack);
if(hl[i+fvb] AND L[i+fvb]>LowMargin)
PlotText("HL",i+fvb+dxll,L[i+fvb]-dyll,colorWhite,colorBlack);
if(hl[i+fvb] AND L[i+fvb]<=LowMargin)
PlotText("HL",i+fvb+dxll+dxllm,L[i+fvb]-dyllm,colorWhite,colorBlack);
if(db[i+fvb] AND L[i+fvb]>LowMargin)
PlotText("DB^",i+fvb+dxll,L[i+fvb]-dyll,colorWhite,colorBlack);
if(db[i+fvb] AND L[i+fvb]<=LowMargin)
PlotText("DB^",i+fvb+dxll+dxllm,L[i+fvb]-dyllm,colorWhite,colorBlack);
if(hh[i+fvb] AND H[i+fvb]<HighMargin)
PlotText("HH",i+fvb+dxhh,H[i+fvb]+dyhh,colorWhite,colorBlack);
if(hh[i+fvb] AND H[i+fvb]>=HighMargin)
PlotText("HH",i+fvb+dxhh+dxhhm,H[i+fvb]+dyhhm,colorWhite,colorBlack);
if(lh[i+fvb] AND H[i+fvb]<HighMargin)
PlotText("LH",i+fvb+dxhh,H[i+fvb]+dyhh,colorWhite,colorBlack);
if(lh[i+fvb] AND H[i+fvb]>=HighMargin)
PlotText("LH",i+fvb+dxhh+dxhhm,H[i+fvb]+dyhhm,colorWhite,colorBlack);
if(dt[i+fvb] AND H[i+fvb]<HighMargin)
PlotText("DTv",i+fvb+dxhh,H[i+fvb]+dyhh,colorWhite,colorBlack);
if(dt[i+fvb] AND H[i+fvb]>=HighMargin)
PlotText("DTv",i+fvb+dxhh+dxhhm,H[i+fvb]+dyhhm,colorWhite,colorBlack);
}
Plot(tr,"",ColorRGB(0,100,0),styleHistogram|styleDashed|styleOwnScale|styleNoLabel,0,1,0,0);
Plot(pk,"",ColorRGB(100,0,0),styleHistogram|styleDashed|styleOwnScale|styleNoLabel,0,1,0,0);
}
_SECTION_END();
/* Fibonacci Internal & External Retracements */
// This is a Modified Version that shows Fibonacci 00% & 100% instead of WRONG Sup & Res
_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
tchoice=Param("Title Selection ",2,1,2,1);
//Plot(C, "", IIf(O>=C, colorRed, colorGreen), ParamStyle("Price Style",styleBar,maskPrice));
//////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Fib Retracements");
fibs = ParamToggle("Plot Fibs","Off|On",1);
pctH = Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
HiLB = Param ("Hi LookBack",1,1,BarCount-1,1);
pctL = Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
LoLB = Param ("Lo LookBack",1,1,BarCount-1,1);
Back = Param ("Extend Left = 2",1,1,500,1);
Fwd = Param("Plot Forward", 0, 0, 500, 1);
text = ParamToggle("Plot Text","Off|On",1);
hts = Param ("Text Shift", -33.5,-50,50,0.10);
style =ParamStyle("Line Style",styleLine,styleNoLabel);
x = BarIndex();
pRp = PeakBars( H, pctH, 1) == 0;
yRp0 = SelectedValue(ValueWhen( pRp, H, HiLB));
xRp0 = SelectedValue(ValueWhen( pRp, x, HiLB));
pSp = TroughBars( L, pctL, 1) == 0;
ySp0 = SelectedValue(ValueWhen( pSp, L, LoLB));
xSp0 = SelectedValue(ValueWhen( pSp, x, LoLB));
Delta = yRp0 - ySp0;
function fib(ret)
{
retval = (Delta * ret);
Fibval = IIf(ret < 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0
AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0
AND xSp0 > xRp0, ySp0 + retval, Null))));
return FibVal;
}
x0 = Min(xSp0,xRp0)-Back;
x1 = (BarCount -1);
//////////////////////////////////////////////////////////////////
r236 = fib(0.236); r236I = LastValue (r236,1);
r382 = fib(0.382); r382I = LastValue (r382,1);
r050 = fib(0.50); r050I = LastValue (r050,1);
r618 = fib(0.618); r618I = LastValue (r618,1);
r786 = fib(0.786); r786I = LastValue (r786,1);
e127 = fib(1.27); e127I = LastValue (e127,1);
e162 = fib(1.62); e162I = LastValue (e162,1);
e200 = fib(2.00); e200I = LastValue (e200,1);
e262 = fib(2.62); e262I = LastValue (e262,1);
e424 = fib(4.24); e424I = LastValue (e424,1);
//////////////////////////////////////////////////////////////////
p00 = IIf(xSp0 > xRp0,ySp0,yRp0); p00I = LastValue (p00,1);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0); p100I = LastValue (p100,1);
color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
//////////////////////////////////////////////////////////////////
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
//////////////////////////////////////////////////////////////////
if(fibs==1)
{
Plot(LineArray(xRp0-Fwd,yRp0,x1,yRp0,Back),"PR",32,8|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(xSp0-Fwd,ySp0,x1,ySp0,Back),"PS",27,8|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,r236,x1,r236,Back),"",45,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,r382,x1,r382,Back),"",44,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,r050,x1,r050,Back),"",41,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,r618,x1,r618,Back),"",43,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,r786,x1,r786,Back),"",42,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,e127,x1,e127,Back),"e127",47,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,e162,x1,e162,Back),"e162",47,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,e200,x1,e200,Back),"p200",47,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,e262,x1,e262,Back),"p262",47,style|styleNoRescale,Null,Null,Fwd);
Plot(LineArray(x0-Fwd,e424,x1,e424,Back),"p424",25,style|styleNoRescale,Null,Null,Fwd);
}
//////////////////////////////////////////////////////////////////
if(text==1)
{
PlotText(" 0% = " + WriteVal(p00,fraction),LastValue(BarIndex())-(numbars/hts), p00I + 0.05, color00);
PlotText("23% = " + WriteVal(r236,fraction),LastValue(BarIndex())-(numbars/hts), r236I + 0.05, 45);
PlotText("38% = " + WriteVal(r382,fraction),LastValue(BarIndex())-(numbars/hts), r382I + 0.05, 44);
PlotText("50% = " + WriteVal(r050,fraction),LastValue(BarIndex())-(numbars/hts), r050I + 0.05, 41);
PlotText("62% = " + WriteVal(r618,fraction),LastValue(BarIndex())-(numbars/hts), r618I + 0.05, 43);
PlotText("78% = " + WriteVal(r786,fraction),LastValue(BarIndex())-(numbars/hts), r786I + 0.05, 42);
PlotText("100% = " + WriteVal(p100,fraction),LastValue(BarIndex())-(numbars/hts),p100I + 0.05, color100);
PlotText("127% = " + WriteVal(e127,fraction),LastValue(BarIndex())-(numbars/hts),e127I + 0.05, 47);
PlotText("162% = " + WriteVal(e162,fraction),LastValue(BarIndex())-(numbars/hts),e162I + 0.05, 47);
PlotText("200% = " + WriteVal(e200,fraction),LastValue(BarIndex())-(numbars/hts),e200I + 0.05, 47);
PlotText("262% = " + WriteVal(e262,fraction),LastValue(BarIndex())-(numbars/hts),e262I + 0.05, 47);
PlotText("424% = " + WriteVal(e424,fraction),LastValue(BarIndex())-(numbars/hts),e424I + 0.05, 25);
}
_SECTION_END();
//////////////////////////////////////////////////////////////////
if (tchoice==1 )
{
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} - {{INTERVAL}}
{{Date}} Open: %g, High: %g, Low: %g, Close: %g
{{VALUES}}",O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
}
//////////////////////////////////////////////////////////////////
if (tchoice==2 )
{
Title = EncodeColor(colorYellow) + "Fibo Retrace n Trendline " + EncodeColor(colorWhite) + Name() + " " + EncodeColor(colorWhite)+ Date() + " Tick = " + EncodeColor(5) +
Interval(2)+
EncodeColor(colorWhite) + " O = " + EncodeColor(colorWhite) + O +
EncodeColor(colorWhite) + " H = " + EncodeColor(5) + H +
EncodeColor(colorWhite) + " L = " + EncodeColor(colorRed) + L +
EncodeColor(colorWhite) + " C = " + EncodeColor(colorWhite) + C + "\n"
+
EncodeColor( colorWhite) + "424% = " + EncodeColor(25)+ e424 + " " +"\n"+
EncodeColor( colorWhite) + "262% = " + EncodeColor(47)+ e262 + " " +"\n"+
EncodeColor( colorWhite) + "200% = " + EncodeColor(47)+ e200 + " " +"\n"+
EncodeColor( colorWhite) + "162% = " + EncodeColor(47)+ e162 + " " +"\n"+
EncodeColor( colorWhite) + "127% = " + EncodeColor(47)+ e127 + " " +"\n"+
EncodeColor( Color100) + "100% = " + EncodeColor(Color100) + p100 + " "+"\n"+
EncodeColor( colorWhite) + "78.6% = " + EncodeColor(42)+ r786 + " " +"\n"+
EncodeColor( colorWhite) + "61.8% = " + EncodeColor(43)+ r618 + " "+"\n"+
EncodeColor( colorWhite) + "50% = " + EncodeColor(41)+ r050 + " "+"\n"+
EncodeColor( colorWhite) + "38.2% = " + EncodeColor(44)+ r382 + " "+"\n"+
EncodeColor( colorWhite) + "23.6% = " + EncodeColor(45)+ r236+ " " +"\n"+
EncodeColor( Color00) + "00% = " + EncodeColor(Color00) + p00 + " " ;
}
GraphXSpace=5;