CountTradingDays ( int toDate );
Description
Returns the number of trading days in the specified time period (including both starting and ending dates) for the current symbol. Note that fromDate
and toDate
parameters should be specified in the YYYYMMDD format.
Input parameters
Parameter | Default value | Description |
---|---|---|
fromDate | - | Defines the beginning date of the period, in the YYYYMMDD format. |
toDate | - | Defines the end date of the period, in the YYYYMMDD format. |
Example
def yearstart = GetYear() * 10000 + 101;
AddLabel(yes, CountTradingDays(yearstart, GetYYYYMMDD()) + " trading days since year start");
This script displays a chart label indicating the number of trading days from the first day of the year to the current day for the chosen symbol.