Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Future Plotting of Time and Price for Amibroker (AFL)

Rating:
2 / 5 (Votes 3)
Tags:
amibroker

This formula plots time and price in the blank space on the right of the chart. To use this you must make sure that Preferences > Charting Blank bars in right margin is set to a value of greater than 0. An example is provided at the bottom of the chart for plotting lines with starting arrays that are beyond the current price bars. Pivot Letters have been assigned to assist in creating explorations for price patterns. Thanks to Tomasz and Marcin for providing assistance with getting me pointed in the right direction with future plotting.

Screenshots

Similar Indicators / Formulas

Kavach Of Karna v2
Submitted by hbkwarez almost 10 years ago
Advanced Elliott Waves
Submitted by MarcosEn over 12 years ago
3_6Day GuaiLiLv
Submitted by motorfly over 12 years ago
Williams Alligator System
Submitted by durgesh1712 over 12 years ago
*Level Breakout system*
Submitted by Tinych over 12 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Chart Settings");
	SetChartOptions(0,chartShowArrows|chartShowDates);
	SetChartBkColor(ParamColor("Outer Panel",1));
	SetChartBkGradientFill(ParamColor("Upper Chart",1),ParamColor("Lower
Chart",23));
	GraphXSpace=Param("GraphXSpace",10,0,100,1);
	dec = (Param("Decimals",2,0,7,1)/10)+1;
	bi = BarIndex();
	Lbi = LastValue(BarIndex());
	sbi = SelectedValue(bi);
	x1= BarCount-1;
SetBarFillColor (IIf(C>O,19,IIf(C<O,24,42))); 
Plot(C,"",IIf(C>O,51,IIf(C<O,33,55)),64); 

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("SV X Pivots");
	pct = Param( "Pivot %",0.18,0.10,60,0.01);
	plt = ParamToggle("Plot Zig ","Off|On",0);
	ppa = ParamToggle("Plot Pattern Lines","Off|On",1);
	plx = ParamToggle("Plot Time Lines","Off|On",1);
	Vsh= Param("Time Line V Shift",0.25,0,10,0.01);
	ptx = ParamToggle("Plot Text","Off|On",1);
	HiLb= Param("Hi Lookback",1,1,x1,1);
	LoLb= Param("Lo Lookback",1,0,x1,1);
//==============================
	pk=PeakBars(H,pct)==0; tr=TroughBars(L,pct)==0;
	zHi=Zig(H,pct); zLo=Zig(L,pct); HLAvg=(zHi+zLo)/2;
	zp=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L)));
	za=Zig(zp,pct);
	pR=Ref(za,-1)<za AND za>Ref(za,1);//pk
	pS=Ref(za,-1)>za AND za<Ref(za,1);//tr
//==============================
if(plt==1)Plot(za,"ZIG",42,32|4096);
//==============================
//Support
	xs0 = SelectedValue(ValueWhen(PS,bi,LoLb));
	xs1 = SelectedValue(ValueWhen(pS,bi,LoLb+1));
	xs2 = SelectedValue(ValueWhen(pS,bi,LoLb+2));
	xs3 = SelectedValue(ValueWhen(pS,bi,LoLb+3));
	xs4 = SelectedValue(ValueWhen(pS,bi,LoLb+4));
	ys0 = SelectedValue(ValueWhen(pS,L,LoLb));
	ys1 = SelectedValue(ValueWhen(pS,L,LoLb+1));
	ys2 = SelectedValue(ValueWhen(pS,L,LoLb+2));
	ys3 = SelectedValue(ValueWhen(pS,L,LoLb+3));
	ys4 = SelectedValue(ValueWhen(pS,L,LoLb+4));
//Resistance
	xr0 = SelectedValue(ValueWhen(pR,bi,HiLb));
	xr1 = SelectedValue(ValueWhen(pR,bi,HiLb+1));
	xr2 = SelectedValue(ValueWhen(pR,bi,HiLb+2));
	xr3 = SelectedValue(ValueWhen(pR,bi,HiLb+3));
	xr4 = SelectedValue(ValueWhen(pR,bi,HiLb+4));
	yr0 = SelectedValue(ValueWhen(pR,H,HiLb));
	yr1 = SelectedValue(ValueWhen(pR,H,HiLb+1));
	yr2 = SelectedValue(ValueWhen(pR,H,HiLb+2));
	yr3 = SelectedValue(ValueWhen(pR,H,HiLb+3));
	yr4 = SelectedValue(ValueWhen(pR,H,HiLb+4));
	Sup = xs0>xr0;
	Res = xr0>xs0;
	xsh = 50;
	xsbi = IIf(Res, xr0-xsh, xs0-xsh);//xstart

	za=Zig(zp,0.01);
	pR=Ref(za,-1)<za AND za>Ref(za,1);//pk
	pS=Ref(za,-1)>za AND za<Ref(za,1);//tr
	eLy = SelectedValue(ValueWhen(pS,L,0));
	eHy = SelectedValue(ValueWhen(pR,H,0));
	d1 = IIf(sup,ely,ehy);
	c1 = IIf(sup,ehy,ely);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("Patterns");
//Assign Letter to Pivots
if(Res==1)  {
	col= 40; colp= 32; va1= 0.30; va2= -0.30;
	Sx = xs4;  Sy = ys4;  Tx = xr4;  Ty = yr4;
	Ux = xs3;  Uy = ys3;  Vx = xr3;  Vy = yr3;
	Wx = xs2;  Wy = ys2;  Xx = xr2;  Xy = yr2;
	Ax = xs1;  Ay = ys1;  Bx = xr1;  By = yr1;
	Cx = xs0;  Cy = ys0;  Dx = xr0;  Dy = yr0; 
}
if(Sup==1)  {
	col= 51; colp= 43; va1= -0.30; va2= 0.30;
	Sx = xr4;  Sy = yr4;  Tx = xs4;  Ty = ys4;
	Ux = xr3;  Uy = yr3;  Vx = xs3;  Vy = ys3;
	Wx = xr2;  Wy = yr2;  Xx = xs2;  Xy = ys2;
	Ax = xr1;  Ay = yr1;  Bx = xs1;  By = ys1;
	Cx = xr0;  Cy = yr0;  Dx = xs0;  Dy = ys0;
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//Calculate Hi Lo Retracements
	WX=(abs(xy-wy)/abs(wy-vy))*100;
	XA=abs(Xy-Ay)/abs(Xy-Wy)*100;
	AB=abs(By-Ay)/abs(Xy-Ay)*100;
	BC=abs(By-Cy)/abs(By-Ay)*100;
	CD=abs(Dy-Cy)/abs(By-Cy)*100;
	CE=(abs(Cy-c1)/abs(Cy-By))*100;
	DE=(abs(Dy-d1)/abs(Cy-Dy))*100;

//Calculate Hi-Hi Lo-Lo Retracements
	XBi= abs(Xy-By)/(abs(Xy-Ay))*100;
	XBe= abs(By-Ay)/(abs(Xy-Ay))*100;
	XB = IIf(By>=Ay,XBe,XBi);
	XD=abs(Dy-Ay)/abs(Xy-Ay)*100;
	ACi=abs(Cy-Ay)/abs(By-Ay)*100;
	ACe=abs(By-Cy)/abs(By-Ay)*100;
	AC = IIf(Cy>=Ay,ACi,ACe);
	BDi=abs(Dy-By)/abs(By-Cy)*100;
	BDe=abs(Dy-Cy)/abs(By-Cy)*100;
	BD = IIf(Dy>=By,BDe,BDi);
//Plot Labels and Retracements
if(ptx==1)  {
	PlotText(" S ",sx,sy + va2, col,1);  PlotText(" T ",tx,ty + va1, col,1);
	PlotText(" U ",ux,uy + va2, col,1);  PlotText(" V ",vx,vy + va1, col,1);
	PlotText(" W ",IIf(sup,xr2,xs2),wy + va2, col,1);  
	PlotText(" X = "+NumToStr(WX,1.1)+" % ",xx,xy + va1, col,1);
	PlotText(" A = "+NumToStr(XA,1.1)+" % ",ax,ay + va2, col,1); 
	PlotText(" B = "+NumToStr(AB,1.1)+" % ",bx,by + va1, col,1);
	PlotText(" C = "+NumToStr(BC,1.1)+" % ",cx,cy + va2, col,1);  
	PlotText(" D = "+NumToStr(CD,1.1)+" % ",dx,dy + va1, colp,1);
	PlotText(" "+NumToStr(de,1.1)+"%",(dx+x1)/2,(dy+d1)/2,42,1);
	PlotText(" "+NumToStr(ce,1.1)+"%",(cx+x1)/2,(cy+c1)/2,42,1);
	PlotText(" "+NumToStr(XB,1.1)+" %",((xx+bx)/2)-2,(xy+by)/2, 40,1);
	PlotText(" "+NumToStr(XD,1.1)+" %",(xx+dx)/2,(xy+dy)/2, 34,1);
	PlotText(" "+NumToStr(AC,1.1)+" %",(ax+cx)/2-2,(ay+cy)/2, 10,1);
	PlotText(" "+NumToStr(BD,1.1)+" %",((bx+dx)/2)-2,(by+dy)/2, 10,1);
}
//Plot Hi-Hi Lo-Lo Lines
if(ppa==1)  {
	Plot(LineArray(dx,dy,x1,d1,0),"",42,32|4096);
	Plot(LineArray(cx,cy,x1,c1,0),"",42,32|4096);
	Plot(LineArray(sx,sy,ax,ay,1),"",35,41|4096|2048);
	Plot(LineArray(ux,uy,ax,ay,1),"",25,41|4096|2048);
	Plot(LineArray(bx,by,dx,dy,0),"",34,32|4096);
	Plot(LineArray(ax,ay,cx,cy,0),"",34,32|4096);
	Plot(LineArray(xx,xy,dx,dy,0),"",32,32|4096);
	Plot(LineArray(xx,xy,bx,by,0),"",32,32|4096);
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	//Count Bars Between Pivots
	xXA=xsbi+abs(ax-xx);
	xXB=xsbi+abs(bx-xx);
	xXC=xsbi+abs(cx-xx);
	xXD=xsbi+abs(dx-xx);
	xAB=xsbi+abs(bx-ax);
	xAC=xsbi+abs(cx-ax);
	xAD=xsbi+abs(dx-ax);
	xBC=xsbi+abs(cx-bx);
	xBD=xsbi+abs(dx-bx);
	xCD=xsbi+abs(dx-cx);
//==============================
if(plx==1) {
bc=IIf(sup,sbi-xs0,sbi-xr0);
tp=IIf(sup,ys0-Vsh,yr0+Vsh);
if(Res==1)  {
col=42;
Plot(bi==xCD, "", colorYellow, styleHistogram|styleOwnScale,0,1,xsh);//sample code if lines are preferred
PlotText("XA\n | "+NumToStr(abs(xx-ax)-bc,1),xxa+xsh,tp,col,1);
PlotText("XB\n | "+NumToStr(abs(bx-xx)-bc,1),xxb+xsh,tp,col,1);
PlotText("XC\n | "+NumToStr(abs(cx-xx)-bc,1),xxc+xsh,tp,col,1);
PlotText("XD\n | "+NumToStr(abs(xx-dx)-bc,1),xxd+xsh,tp,col,1);
PlotText("AB\n | "+NumToStr(abs(bx-ax)-bc,1),xab+xsh,tp,col,1);
PlotText("AC\n | "+NumToStr(abs(cx-ax)-bc,1),xac+xsh,tp,col,1);
PlotText("AD\n | "+NumToStr(abs(dx-ax)-bc,1),xad+xsh,tp,col,1);
PlotText("BC\n | "+NumToStr(abs(cx-bx)-bc,1),xbc+xsh,tp,col,1);
PlotText("BD\n | "+NumToStr(abs(dx-bx)-bc,1),xbd+xsh,tp,col,1);
PlotText("CD\n | "+NumToStr(abs(dx-cx)-bc,1),xcd+xsh,tp,col,1);
   }
if(Sup==1)  {
col=34;
Plot(bi==xCD, "", colorYellow, styleHistogram|styleOwnScale,0,1,xsh);//sample code if lines are preferred
PlotText("| "+NumToStr(abs(xx-ax)-bc,1)+"\nXA",xxa+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(bx-xx)-bc,1)+"\nXB",xxb+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(cx-xx)-bc,1)+"\nXC",xxc+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(xx-dx)-bc,1)+"\nXD",xxd+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(bx-ax)-bc,1)+"\nAB",xab+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(cx-ax)-bc,1)+"\nAC",xac+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(dx-ax)-bc,1)+"\nAD",xad+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(cx-bx)-bc,1)+"\nBC",xbc+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(dx-bx)-bc,1)+"\nBD",xbd+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(dx-cx)-bc,1)+"\nCD",xcd+xsh,tp,col,1);
   }
}
//example of plotting line with start at a future point
f50= ys0+(abs(yr0-ys0)*0.50);
Plot(LineArray(xxb,f50,xxd,f50,0),"",29,32,0,0,xsh);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Title = EncodeColor(55)+  Title = Name() + "     " + EncodeColor(32) + Date() +
"      " + EncodeColor(5) + "{{INTERVAL}}  " +
	EncodeColor(55)+ "     Open = "+ EncodeColor(52)+ WriteVal(O,dec) + 
	EncodeColor(55)+ "     High = "+ EncodeColor(5) + WriteVal(H,dec) +
	EncodeColor(55)+ "      Low = "+ EncodeColor(32)+ WriteVal(L,dec) + 
	EncodeColor(55)+ "    Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
	EncodeColor(55)+ "    Volume = "+ EncodeColor(52)+ WriteVal(V,1);

7 comments

1. Alok

Gives Error 30 Syntax error

2. administrator

Alok thank you for pointing it out it has been fixed.

3. roneen

bro thnx for the formula…could u please explain in brief how to use the Future Plotting of Time and Price. thank you

4. razasia

Error 30. Syntax Error on the following:

SetBarFillColor (IIf(C>O,19,IIf(C<O,24,42)));

5. administrator

Razasia your version of Amibroker is outdated. Either delete that line or upgrade Amibroker to a newer version.

6. mahsud

This is the 3rd time, i have tried it but i could NOT see the future price ! Can someone explain how to use / read the future price !

7. mgandhi443

Dear Adminstrator please explain some brief about this afl if you can regars, little one idea will work for us

Leave Comment

Please login here to leave a comment.

Back