Skip to main content

Options expiration ribbon for Amibroker (AFL)

jaonn over 15 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 1)
  • Tags:
    amibroker, options

Displays either a user-selectable ribbon or histogram.

For the ribbon,
red indicates the third Friday of the month.
green indicates the day before a non-trading day (usually a holiday).

The expiry formula was posted by Tomacz J.

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Options Expiration");
dow = DayOfWeek();
expiry = IIf(dow<=5 AND Ref( dow < 2, 1 ) AND Day() > 14  AND Day() < 22,True,False);
Holiday = (dow==5 AND Ref(dow,1)>1) OR (dow<5 AND Ref(Day(),1)>Day()+1);
showRibbon = ParamList("Show Ribbon", "Yes,No");
if (showRibbon == "Yes")
	Plot(3, "Ribbon", IIf(expiry, colorRed, IIf(Holiday, colorDarkGreen, colorLightGrey)), styleOwnScale|styleArea|styleNoLabel, -0.5, 100);
else
	Plot( expiry+2*Holiday, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), styleHistogram | styleOwnScale ); 

_SECTION_END();

0 comments

Leave Comment

Please login here to leave a comment.