Syntax
Public Function ChartPeriod(Optional chart_id As long = 0) As Integer
Description
This function is used to return the timeframe value (one of the ENUM_TIMEFRAMESvalue) for aspecified chart.
Parameters
Key | Description |
chart_id | Chart identifier, 0 is the current chart, value of type Long. |
Return value
Returns one of the ENUM_TIMEFRAMES. If the chart does not exist it returns 0.In order to get an error, callGetLastError()function.
Sample
Public Sub main()Select Case ChartPeriod() 'Select PeriodCase 1AlertMessage "Period = 1 minute" Case 2AlertMessage "Period = 5 minutes" Case 3AlertMessage "Period = 15 minutes" Case 4AlertMessage "Period = 30 minutes" Case 5AlertMessage "Period = 1 hour" Case 6AlertMessage "Period = 4 hours" Case 7AlertMessage "Period = 1 day" Case 8AlertMessage "Period = 1 week" Case 9AlertMessage "Period = 1 month" Case Else AlertMessage "Chart not selected" End SelectEnd Sub
See Also