Skip to main content

IDX Fraction Price for Amibroker (AFL)

saukyk almost 6 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 3)
  • Tags:
    amibroker, ihsg, Indonesia, jakarta, jse, idx, fraksi, fraction

This function to calculate Fraction Price in Amibroker for Indonesia Stock Exchange Stocks

Indicator / Formula

Copy & Paste Friendly
//This function to calculate Fraction Price in Amibroker for Indonesia Stock Exchange Stocks

function FraksiPrice(price) 
{ 
	Fraksi = IIf(Price<200,1,IIf(Price>=200 AND Price <500,2,IIf(Price>=500 AND Price<2000,5,IIf(Price>=2000 AND Price<5000,10,25))));
	Result = Price - (Price%Fraksi);
	return result;
}

function PriceAdj(price,adj) 
{ 
	Fraksi = IIf(Price<200,1,IIf(Price>=200 AND Price <500,2,IIf(Price>=500 AND Price<2000,5,IIf(Price>=2000 AND Price<5000,10,25))));
	Result = Price + (Adj*Fraksi);
	return result;
}


// Example to calculate StopLoss with 2 ticks below MA20
StopLoss = PriceAdj(FraksiPrice(MA(C,20)),-2);

1 comments

Leave Comment

Please login here to leave a comment.