Postby TJ » 20 Nov 2015
Next3rdFriday (Function)
The Next3rdFriday function calculates the number of calendar days to the next 3rd Friday of a month.
Syntax
Next3rdFriday( Series )
Returns (Integer)
A numeric value containing the number of calendar days to the 3rd Friday of the Nth month ahead.
Parameters
Series -- Numeric
Sets the months (ahead) to get the next 3rd Friday. 0=current month, 1=next month, and so on.
Remarks
For the current month, Next3rdFriday(0) will return a negative number of days if the current day of the current month is past the 3rd Friday. In a similar manner, Next3rdFriday(1) returns the number of days to the next 3rd Friday even if it is in the same month as the current day.
Example
If you want to exit out of long positions ten days before the 3rd Friday of the coming month, you can write
If Next3rdFriday(1) <= 10 Then
Sell Next Bar at Market;