CalcTime (Function)

image\trumpet2.gif Disclaimer

The CalcTime function adds and subtracts minutes from a reference time. The reference time is a numeric value in 24-hour military time format: HHMM (Hour Hour Minute Minute).

For example, 10:15am = 1015, or 1345 = 1:45pm

When working with hour and minutes, it is sometimes difficult to add or subtract some number of minutes with an HHMM time. For example, if you wanted to subtract 15 minutes from noon you might try 1200 – 15, which would result in an answer of 1185, which is not a valid time. CalcTime solves this by returning the correct and valid time of 1145.

Syntax

CalcTime(RefTime,MinuteChange)

Returns (Integer)

A numeric value that represents the time in 24-hour format for the current bar.

Parameters

Name

Type

Description

RefTime

Numeric

Specifies the chart time in 24-hour time format to use as the reference time for the calculation, entered in HHMM format. (Examples: 0930, 1245, 1600)

MinuteChange

Numeric

Sets the minutes to be added (positive value) or subtracted (negative value).

Remarks

EasyLanguage does not see time and date as unique data formats but sees them and treats them as normal numeric values.

Example

Assigns to Value1 the calculated time 15 minutes from market close and then plots a PaintBar on every bar after that time:

Value1 = CalcTime(1600,-15);

if Time >= Value1 then

 PlotPB(High,Low, "CalcTime");

See Also

CalcDate