Thursday, 7 March 2019

AmiBroker AFL using Switch with DayOfWeek()












function DayOfWeekName()
{
    dayInt = DayOfWeek();
    dayStr =
        WriteIf(dayInt == 0, "Sunday",
        WriteIf(dayInt == 1, "Monday",
        WriteIf(dayInt == 2, "Tuesday",
        WriteIf(dayInt == 3, "Wednesday",
        WriteIf(dayInt == 4, "Thursday",
        WriteIf(dayInt == 5, "Friday",
        WriteIf(dayInt == 6, "Saturday",
            "Unknown")))))));

    return dayStr;
}

_N(Title = "{{NAME}} - {{INTERVAL}} " + DayOfWeekName() + ", {{DATE}} " + StrFormat("Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

No comments:

Post a Comment

Thanks