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

Zerolag Tema System for Amibroker (AFL)

Copy & Paste Friendly
_SECTION_BEGIN("Heikin Ashi");
function ZeroLagTEMA( array, period ) 
{ 
 TMA1 = TEMA( array, period ); 
 TMA2 = TEMA( TMA1, period ); 
 Diff = TMA1 - TMA2; 
 return TMA1 + Diff ; 
} 

/////////////////////// Heikin-Ashi code 
HaClose = (O+H+L+C)/4; 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); 

avp = Param("Up TEMA avg", 34, 1, 100 ); 
avpdn = Param("Dn TEMA avg", 34, 1, 100 ); 

// Velvoort is using not original, but modified Heikin-Ashi close 
HaClose = ( HaClose + HaOpen + Max( H, HaOpen ) + Min( L, HaOpen ) )/4; 

// up average 
ZlHa = ZeroLagTEMA( HaClose, avp ); 
ZlCl = ZeroLagTEMA( ( H + L ) / 2, avp ); 
ZlDif = ZlCl - ZlHa; 

keep1 = Hold( HaClose >= HaOpen, 2 ); 
keep2 = ZlDif >= 0; 
keeping = keep1 OR keep2; 
keepall = keeping OR ( Ref( keeping, -1 ) AND ( C > O ) OR C >= Ref( C, -1 ) ); 
keep3 = abs( C - O ) < ( H - L ) * 0.35 AND H >= Ref( L, -1 ); 
utr = keepall OR ( Ref( keepall, -1 ) AND keep3 ); 

// dn average 
ZlHa = ZeroLagTEMA( HaClose, avpdn ); 
ZlCl = ZeroLagTEMA( ( H + L ) / 2, avpdn ); 
ZlDif = ZlCl - ZlHa; 

keep1 = Hold( HaClose < HaOpen, 2 ); 
keep2 = ZlDif < 0; 
keeping = keep1 OR keep2; 
keepall = keeping OR ( Ref( keeping, -1 ) AND ( C < O ) OR C < Ref( C, -1 ) ); 
keep3 = abs( C - O ) < ( H - L ) * 0.35 AND L <= Ref( H, -1 ); 
dtr = keepall OR ( Ref( keepall, -1 ) AND keep3 ); 

upw = dtr == 0 AND Ref( dtr, -1 ) AND utr; 
dnw = utr == 0 AND Ref( utr, -1 ) AND dtr; 

Haco = Flip( upw, dnw ); 


if( ParamToggle("Chart Type", "Price with color back|HACO wave" ) ) 
{ 
 Plot( Haco, "Haco", colorRed ); 
} 
else 
{ 
 Plot( C, "Close", colorBlack, ParamStyle( "Style", styleCandle, maskPrice ) ); 
 Plot( 1, "", IIf( Haco , colorPaleGreen, colorPink ), styleArea | styleOwnScale| styleNoLabel, 0, 1 ); 
}


def_Buy = GetFnData("Beta")>1.1 AND V>1000 AND V>EMA(V,50) AND Close>10;
def_Sell =GetFnData("Beta")>1.1 AND V>1000 AND V>EMA(V,50) AND Close>10;


//Buy  =  def_Buy AND Flip(upw,dnw) AND Ref(Flip(dnw,upw),-1);
//Sell =  def_Sell AND Flip(dnw,upw) AND Ref(Flip(upw,dnw),-1);


sector = SectorID(1);
industry = IndustryID(1);



//...........................................
Haco=Flip(upw,dnw);
 
hc = Haco - Ref(Haco,-1);hc = Ref(hc,-1);
Buy = IIf(hc == 1,1,0); BuyPrice = O;
Sell = IIf(hc == -1,1,0); SellPrice = O;
Cover = Buy; CoverPrice = O;
Short = Sell; ShortPrice = O;
 Filter = Buy OR Sell;

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-15);
PlotShapes(IIf(Buy,shapeHollowUpArrow,shapeNone),colorWhite,0,L,-15);
PlotShapes(IIf(Buy,shapeHollowSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);
 
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeHollowDownArrow,shapeNone),colorWhite,0,H,-15);
PlotShapes(IIf(Sell,shapeHollowSmallCircle,shapeNone),colorWhite,0,SellPrice,0);
 
PlotShapes(IIf(Short,shapeDownTriangle,shapeNone),colorYellow,0,H,IIf(Short AND Sell,-30,-15));
PlotShapes(IIf(Short,shapeHollowDownTriangle,shapeNone),colorWhite,0,H,IIf(Short AND Sell,-30,-15));
PlotShapes(IIf(Short,shapeHollowCircle,shapeNone),colorWhite,0,ShortPrice,0);
 
PlotShapes(IIf(Cover,shapeUpTriangle,shapeNone),colorLightBlue,0,L,IIf(Cover AND Buy,-30,-15));
PlotShapes(IIf(Cover,shapeHollowUpTriangle,shapeNone),colorWhite,0,L,IIf(Cover AND Buy,-30,-15));
PlotShapes(IIf(Cover,shapeHollowCircle,shapeNone),colorWhite,0,CoverPrice,0);
 

AddColumn(IIf(Buy, 66,IIf(Sell, 83,Null )),"Buy/Sell",formatChar,IIf(Buy,colorGreen,IIf(Sell,colorRed,colorDefault)),colorDefault,width = 60);
AddColumn(C,"Close",0,IIf(C>Ref(C,-1),colorGreen,IIf(C<Ref(C,-1),colorRed,colorBlue)));
AddColumn(ROC(C,1),"Change %",0,IIf(C>Ref(C,-1),colorGreen,IIf(C<Ref(C,-1),colorRed,colorBlue)));
AddColumn(V,"Volume",1.0,IIf(V>Ref(V,-1)AND C>Ref(C,-1),colorGreen,IIf(V>Ref(V,-1)AND C<Ref(C,-1),colorRed,colorBlue)),colorDefault);
AddColumn(GetFnData("Beta"),"Beta");
AddTextColumn(Sector,"Sector Name" );
AddTextColumn(Industry,"Industry Name");  
AddColumn(GetFnData("InsiderHoldPercent"),"Insider Hold Percent");
AddColumn(GetFnData("InstitutionHoldPercent"),"Institution Hold Percent"); 
_SECTION_END();
Back