Home
Loading...

Amibroker DSE fundamental data display

_SECTION_BEGIN("stockinsides_funda");
//|-----------------------------------------------------------------------------------------
//|Custom formula for DSE fundamental data display
//|Copyright ©, stockinsides.com
//|http://www.stockinsides.com
//|e-mail: stockinsides@gmail.com
//|whatsapp: 01678132377
//|-----------------------------------------------------------------------------------------

// General Settings
GfxSetBkMode(1); // Transparent background
GfxSetOverlayMode(0);
GfxSetTextAlign(0); // Center alignment

FS = Param("Font Size", 20, 5, 100, 1); // Param to adjust font size dynamically
Hor = Param("Horizontal Position", 10, 1, 1200, 1); // Horizontal position
Ver = Param("Vertical Position", 10, 1, 830, 1);    // Vertical position
Name_color = ParamColor("Name color", colorWhite);   // Parameter for Name color
Price_color_up = ParamColor("Price Up Color", colorLime);   // Parameter for price up color
Price_color_down = ParamColor("Price Down Color", colorRed); // Parameter for price down color
Financial_data_color = ParamColor("Financial Data Color", colorWhite); // Parameter for financial data color
Highlight_color = ParamColor("Highlight Color", colorYellow); // Parameter for highlighted text color

// Drawing text using dynamic font size
GfxSelectFont("Tahoma", FS, 700, False); // Using FS for main font size
GfxSetTextColor(Name_color);
GfxTextOut("" + Name(), Hor - 5, Ver + 150);

// Current and Previous Day's Close
YC = TimeFrameGetPrice("C", inDaily, -1);
DD = Prec(C - YC, 2);
DC = Prec((DD / YC) * 100, 2);
price_up = WriteIf(DD > 0, "up", "");

// Adjust font size for specific text (like close price, net change, etc.)
GfxSelectFont("Tahoma", FS * 0.8, 900, False); // Smaller font for price
GfxSetTextColor(IIf(price_up == "up", Price_color_up, Price_color_down)); // Conditional color change based on price movement
GfxTextOut("C " + C, Hor - 5, Ver + 40);     // Close price
GfxTextOut("D " + DC + "%", Hor - 5, Ver + 65); // Change in percentage
GfxTextOut("Net " + DD, Hor - 5, Ver + 90);  // Net change

// 52 Week High and Low
High52 = HHV(High, 250);
Low52 = LLV(Low, 250);
// Text for 52-week low and high
GfxSelectFont("Tahoma", FS * 0.7, 700, False); // Slightly smaller font for 52-week range
GfxSetTextColor(Name_color);
GfxTextOut("L " + Low52 + " | H " + High52, Hor - 5, Ver + 120);

// Parameters for Financial Data Display
FS_Financial = Param("Financial Data Font Size", 10, 5, 100, 1); // Font size for Financial Data
Hor_Financial = Param("Financial Data Horizontal Position", 10, 1, 1200, 1); // Horizontal position for Financial Data
Ver_Financial = Param("Financial Data Vertical Position", 15, 1, 830, 1); // Vertical position for Financial Data
Gap_Financial = Param("Financial Data Horizontal Gap", 160, 10, 500, 10); // Gap between each text in Financial Data

// Parameters for Earnings and PE Calculation
FS_Earnings = Param("Earnings and PE Font Size", 10, 5, 100, 1); // Font size for Earnings and PE
Hor_Earnings = Param("Earnings Data Horizontal Position", 10, 1, 1200, 1); // Horizontal position for Earnings and PE
Ver_Earnings = Param("Earnings Data Vertical Position", 30, 1, 830, 1); // Vertical position for Earnings and PE
Gap_Earnings = Param("Earnings Data Horizontal Gap", 160, 10, 500, 10); // Gap between each text in Earnings and PE

// Financial Data Display
if (GetFnData("SharesOut") != 0) {
    paidup = Prec(GetFnData("SharesOut") / 100000, 2);
    
    // Set font and text color for Financial Data
    GfxSetTextColor(Financial_data_color);
    GfxSelectFont("Tahoma", FS_Financial, 700, False); // Use FS_Financial for font size
    
    GfxTextOut("PaidUp: " + paidup + " mn", Hor_Financial, Ver_Financial);
    GfxTextOut("| NAV: " + Prec(GetFnData("BookValuePerShare"), 2) + " ps", Hor_Financial + Gap_Financial, Ver_Financial);
    GfxTextOut("| D: " + Prec(GetFnData("InsiderHoldPercent"), 2) + " %", Hor_Financial + 2 * Gap_Financial, Ver_Financial);
    GfxTextOut("| P: " + Prec(GetFnData("SharesFloat"), 2) + " % (" + Prec(((paidup * GetFnData("SharesFloat")) / 1000), 2) + ")", Hor_Financial + 3 * Gap_Financial, Ver_Financial);
    
    GF = 100 - (GetFnData("InsiderHoldPercent") + GetFnData("InstitutionHoldPercent") + GetFnData("SharesFloat"));
    if (GF != 0) {
        GfxTextOut("| G/F: " + Prec(GF, 2) + " %", Hor_Financial + 4 * Gap_Financial, Ver_Financial);
    }

    GfxTextOut("| I: " + Prec(GetFnData("InstitutionHoldPercent"), 2) + " %", Hor_Financial + 5 * Gap_Financial, Ver_Financial);
    
    if (GetFnData("SharesShortPrevMonth") != 0) {
        GfxSetTextColor(Highlight_color);
        GfxTextOut("| Change: " + Prec(GetFnData("SharesShortPrevMonth"), 2) + " %", Hor_Financial + 6 * Gap_Financial, Ver_Financial);
    }
}

// Earnings and PE Calculation
ForwardEPS = IIf(GetFnData("ForwardEPS") != 0, GetFnData("ForwardEPS"), Null);
PE = Prec(Close / ForwardEPS, 2);
EP = Prec(ForwardEPS / Close, 4) * 100;

GfxSetTextColor(Financial_data_color);
GfxSelectFont("Tahoma", FS_Earnings, 700, False); // Use FS_Earnings for font size

if (GetFnData("EPS") != 0) {
    GfxTextOut("AEPS: " + Prec(GetFnData("EPS"), 2) + " Tk", Hor_Earnings, Ver_Earnings);
    GfxTextOut("| FEPS: " + Prec(ForwardEPS, 2) + " Tk", Hor_Earnings + Gap_Earnings, Ver_Earnings);
    GfxTextOut("| APE: " + Prec(Close / GetFnData("EPS"), 2), Hor_Earnings + 2 * Gap_Earnings, Ver_Earnings);
    GfxTextOut("| PE: " + PE + " | EP: " + EP + "%", Hor_Earnings + 3 * Gap_Earnings, Ver_Earnings);
}

if (GetFnData("ForwardEPS") != 0) {
    GfxSetTextColor(Highlight_color);
    GfxTextOut("| Interim " + GetFnData("Alias"), Hor_Earnings + 4 * Gap_Earnings, Ver_Earnings);
}

// Next Quarter EPS Estimate
if (GetFnData("EPSEstNextQuarter") != 0) {
    GfxTextOut("| ENQ: " + Prec(GetFnData("EPSEstNextQuarter"), 2) + " Tk", Hor_Earnings + 5 * Gap_Earnings, Ver_Earnings);
}

// Quarterly Growth
if (GetFnData("QtrlyEarningsGrowth") != 0) {
    GfxSetTextColor(Highlight_color);
    GfxTextOut("| Growth: " + Prec(GetFnData("QtrlyEarningsGrowth"), 2) + " %", Hor_Earnings + 6 * Gap_Earnings, Ver_Earnings);
}

GfxSetBkMode(0);
_SECTION_END();


WhatsApp Icon Chat on WhatsApp