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 ....
Find Out More Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

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

Suppy-Demand Zone for Amibroker (AFL)

Rating:
3 / 5 (Votes 3)
Tags:
amibroker, supply, demand

This was posted in facebook.com/groups/AmibrokerAFLcollection/ , coded by Sonica
and it’s Alfonso Moreno concept , supply Demand Zone’s are not accurate , but it’s Good Attempt .

Screenshots

Indicator / Formula

Copy & Paste Friendly
SetBarsRequired( sbrAll,sbrAll ) ;

_SECTION_BEGIN("Background color");
SetChartOptions(0, chartShowArrows|chartShowDates);      
Conmt=Param("Contrac", 0.4,0.01,1,0.01);        
Ccol=(ColorBlend(ColorRGB(165,160,125) , 1, Conmt));   
SetChartBkColor(ParamColor("Axis color ",colorGrey50));
SetChartBkGradientFill( Ccol,Ccol);
_SECTION_BEGIN("Price Style-color");
Show = ParamToggle( "style", "Bar|Candle", 1 );
if ( Show )
{
Sy=styleCandle;
}
else
{
Sy=styleBar|styleThick;
}
color=IIf(C>O,colorPaleGreen,IIf(C<O,colorPink,1));
xshift=Param("Shift bar",0,-5,5,1);
zorder=Param("Zorder",0,-5,5,1);
width=Param("bar width/thickness",3,0,10,1);
PlotOHLC(Open,High,Low,Close,"",color,sy,Null,Null,xshift,zorder,width);

_SECTION_END(); 
_SECTION_BEGIN("SZ-DZ v3a");
Fvb=Status("firstvisiblebar");

O1 = Ref(O,-1);O2 = Ref(O,-2);O3 = Ref(O,-3);O4 = Ref(O,-4);
H1 = Ref(H,-1);H2 = Ref(H,-2);H3 = Ref(H,-3);H4 = Ref(H,-4);
L1 = Ref(L,-1);L2 = Ref(L,-2);L3 = Ref(L,-3);L4 = Ref(L,-4);
C1 = Ref(C,-1);C2 = Ref(C,-2);C3 = Ref(C,-3);C4 = Ref(C,-4);
Range =H - L;
IB=Inside();
x=Cum(1);
RP=Param("RP",1.25, 1, 3,0.25);
MAHL =  RP * Ref(range,-1);
GB=(H-L) > (MAHL) AND  C>O ;
RB=(H-L) > (MAHL) AND  C<O ;
Hz=ValueWhen(rb,H,1);
Lz=ValueWhen(rb,L,1);
Hy=ValueWhen(gb,H,1);
ly=ValueWhen(gb,L,1);

Type = ParamList("Type","2|3|4",1);
m=n=0;
if(Type == "4"){
M=Iif(((Max(O,c)<Ref(HZ,-4) and Min(O,c)>Ref(Lz,-4)))AND
 ((Max(O3,c3)<Ref(HZ,-4)  and  Min(O3,c3)> Ref(Lz,-4)))AND
 ((Max(O2,c2)<Ref(HZ,-4)  and  Min(O2,c2)> Ref(Lz,-4)))AND
 ((Max(O1,c1)<Ref(HZ,-4)  and  Min(O1,c1)> Ref(Lz,-4))),1,0);
MV= Max(o4,Max(O3,Max(O2,Max(O1,max(c4,Max(C3,Max(c2,C1)))))));
N=Iif(((Max(O,c)<Ref(Hy,-4) and Min(O,c)>Ref(Ly,-4)))AND
 ((Max(O3,c3)<Ref(Hy,-4) and  Min(O3,c3)> Ref(Ly,-4)))AND
 ((Max(O2,c2)<Ref(Hy,-4) and  Min(O2,c2)> Ref(Ly,-4)))AND
 ((Max(O1,c1)<Ref(Hy,-4) and  Min(O1,c1)> Ref(Ly,-4))),1,0);
NV= Min(o4,Min(O3,Min(O2,Min(O1,Min(c4,Min(C3,Min(c2,C1)))))));} 
 
if(Type == "3"){
M=IIf(((Max(O,c)<Ref(HZ,-3)  and  Min(O,c)> Ref(Lz,-3))) AND
((Max(O2,c2)<Ref(HZ,-3)  and  Min(O2,c2)> Ref(Lz,-3))) AND
((Max(O1,c1)<Ref(HZ,-3)  and  Min(O1,c1)> Ref(Lz,-3))),1,0);
MV= Max(O3,Max(O2,Max(O1,Max(C3,Max(c2,C1)))));
N=IIf(((Max(O,c)<Ref(Hy,-3) and  Min(O,c)> Ref(Ly,-3))) AND
((Max(O2,c2)<Ref(Hy,-3) and  Min(O2,c2)> Ref(Ly,-3))) AND
((Max(O1,c1)<Ref(Hy,-3) and  Min(O1,c1)> Ref(Ly,-3))),1,0);
NV= Min(O3,Min(O2,Min(O1,Min(C3,Min(c2,C1)))));}

if(Type == "2"){
M=IIf(((Max(O,c)<Ref(HZ,-2)  and  Min(O,c)> Ref(Lz,-2))) AND
((Max(O1,c1)<Ref(HZ,-3)  and  Min(O1,c1)> Ref(Lz,-2))),1,0);
MV= Max(O2,Max(O1,Max(c2,C1)));
N=IIf(((Max(O,c)<Ref(Hy,-2) and  Min(O,c)> Ref(Ly,-2))) AND
((Max(O1,c1)<Ref(Hy,-2) and  Min(O1,c1)> Ref(Ly,-2))),1,0);
NV= Min(O2,Min(O1,Min(c2,C1)));}

Pk1= Ref(m,-1) AND RB ;
Hv1=ValueWhen(PK1,mv,1);
Lv1=ValueWhen(PK1,nv,1);
NoLines = Param("No of Lines",5,1,10,1)+1;

for( i = 1; i < NoLines ; i++ )
{
rcol=ColorHSB( 20*(i),200, 255);
px1 = LastValue(ValueWhen(pk1,x,i)) ;
py1 = LastValue(ValueWhen(pk1,hv1,i)) ;
pH = LineArray(px1-2, py1, (BarCount-1), py1);
Plot(pH,"",rcol,32|styleNoRescale,Null,Null,0,0,0);
Pz1 = LastValue(ValueWhen(pk1,lv1,i)) ;
PL = LineArray(px1-2, Pz1, (BarCount-1), Pz1);
Plot(PL,"",rcol,32|STYLENORESCALE,Null,Null,0,0,0);
PlotOHLC(PH,PH,PL,PL,"",rcol,styleCloud|styleNoLabel,Null,Null,0,-i,0);
}
//===================================================================================
		
Tk1=Ref(n,-1) AND GB ;
Hv2=ValueWhen(TK1,mv,1);
Lv2=ValueWhen(TK1,nv,1);

for( i = 1; i < NoLines ; i++ )
{
scol=ColorHSB( 20*(i),200, 155);
tx1 = LastValue(ValueWhen(tk1,x,i)) ;
ty1 = LastValue(ValueWhen(tk1,hv2,i)) ;
TH = LineArray(tx1-2, ty1, (BarCount-1), ty1);
Plot(th,"",scol,32|styleNoRescale,Null,Null,0,0,0);
tz1 = LastValue(ValueWhen(tk1,lv2,i)) ;
TL = LineArray(tx1-2, tz1, (BarCount-1), tz1);
Plot(TL,"",scol,32|styleNoRescale,Null,Null,0,0,0);
PlotOHLC(TH,TH,TL,TL,"",scol,styleCloud|styleNoLabel,Null,Null,0,-i,0);
}


_SECTION_END();

_SECTION_BEGIN("Title");
gxs=Param("GRAPH spaceing",10,5,50,5);       
GraphXSpace = gxs; 
strWeekday = StrMid("SunMonTueWedThuFriSat", SelectedValue(DayOfWeek())*3,3);
if( Status("action") == actionIndicator ) 
(
Title = EncodeColor(colorWhite)+ "SZ-DZ v3a" + " - " +  Name() +
 " | " + EncodeColor(colorLime)+ Interval(2) + EncodeColor(colorWhite) + "  #  "+strWeekday +" , "+ Date()+
"\n"+EncodeColor(colorwhite) +"Op -"+O+" : "+EncodeColor(colorLime)+"Hi-"+H+" :  "+EncodeColor(colorOrange)+"Lo-"+L+"  : "+EncodeColor(colorTan)+ "Cl-"+C+" : "+EncodeColor(colorYellow)+ "Vol= "+ WriteVal(V,1)
+"\nRng "+ rp +" , "+ "Type "+type+" , "+ "Disp Zone "+(Nolines-1)); 
_SECTION_END();

2 comments

1. kuzukapama

error ,, formulas not working ,,,,

2. rajenvyas

Thanks for giving credit to coders of my group.

Leave Comment

Please login here to leave a comment.

Back