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

Various Functions for Amibroker (AFL)

Rating:
3 / 5 (Votes 3)
Tags:
amibroker, functions

Here some function help people create indicator faster

Indicator / Formula

Copy & Paste Friendly
//get the max price in any day
function getMaxPriceDuration(Value,NumberOfDay){
	pr = HHV(Ref(Value,-1),NumberOfDay);
	return pr;
};

//get the min price in any day
function getMinPriceDuration(Value,NumberOfDay){
	pr = LLV(Ref(Value,-1),NumberOfDay);
	return pr;
};

//calculate band of price
function calBandPrice(percent,period){
	priceMax = getMaxPriceDuration(C,period);
	priceMin = getMinPriceDuration(C,period);
	return priceMax < percent * priceMin; 
};

function ConditionCrossTwoMA(price,top,bottom){
	return Cross(MA(price,top),MA(price,bottom));
}

function ConditionPriceIsAboveMA(price,period){
	return price > MA(price,period);
}

function ConditionMACDAboveSign(){
	return MACD(12,26)>Signal(12,26,9) AND (MACD(12,26)>Ref(MACD(12,26),-1));
}

//function ConditionBBandExtend(){
	//return (BBandTop(C,15,2)>BBandTop(Ref(C,-1),15,2)) AND BBandBot(C,15,2)<BBandBot(Ref(C,-1),15,2);
//}

function CalBollingerBanWidth(period){
	MAveger = MA(C,period);
	BBtop = BBandTop(C,period,2);
	BBbottom = BBandBot(C,period,2);
	BBWidth = ((BBtop - BBbottom)/MAveger)*100;
	return BBWidth;
}

function CalBollingerB(period){
	MAveger = MA(C,period);
	BBtop = BBandTop(C,period,2);
	BBbottom = BBandBot(C,period,2);
	PercentB = (C-BBbottom)/(BBtop - BBbottom);
	return PercentB;
}

function ConditionADX(Limit){
	return ADX(14)> Limit;
}

function isOverBought(Limit){
	return RSI(14)>70;
}

function isOverSold(Limit){
	return RSI(14)<20;
}

function isUpperTrend(){
	return (PDI(14) > MDI(14)) 
	//AND (PDI(14)>Ref(PDI(14),-1))
	;
}

function isLowerTrend(){
	return (PDI(14) < MDI(14)) 
	//AND (PDI(14)< Ref(PDI(14),-1))
	;
}
function isSuddenVolume(scale,Vol){
	return V >= scale*Ref(V,-1) 
	AND V>Vol
	;
}

//find volume is bigger then a number
function isVolBiggerThan(number){
	return V >=number
	;
}

function isMoneyFlowBig(index){
	return MFI(14) > index;
}

//find the volume is bigger than anyday
function isVolBiggerThanSomeDay(somedays){
	return V>Sum(Ref(V,-1),somedays);
}

3 comments

1. SADAI

Good effort to learn the beginners

2. moccha

Nice Simple code

3. AMI1004

Thanks

Leave Comment

Please login here to leave a comment.

Back