How to write Expiry date in custom indicator

#2
This indicator returns 1 if it is the last thursday of the month, else it returns 0. Will also plot a spike on daily charts on the last thursday of the month.

mdays:= 31;
mm:= Month();
mdays:= If((mm=4) OR (mm=6) OR (mm=9) OR (mm=11),30, mdays);
mdays:= If(mm=2, 28, mdays);
leap:=Year() - 4*Int(Year()/4);
mdays:= If(mm=2 AND leap=0, 29, mdays);
FNOEXPIRY:=If( (DayOfMonth() > mdays-7) AND (DayOfWeek()=4), 1, 0);
FNOEXPIRY

Well, this is mostly FNOEXPIRY date!
Though there is a bug, it will still work in 2100!
 
Last edited: